Error Codes

Error Codes

The following is a list of error codes that each client app should handle under certain conditions

  • 401 - Unauthorized can be returned when an access token has expired.

 

Handling the errors

  1. HTTP status 401 Unauthorized
    EXAMPLE:

    { "error": "unauthorized", "error_description": "Full authentication is required to access this resource" }

     

    { "error": "invalid_token", "error_description": "Invalid JOSE Header kid (bAhhLdFBZDWpzbCDiuQpDJ40Bricn3avTL3l9LZxB3Y=)" }

     

    { "error": "unauthorized", "error_description": "Token expired" }

    Such error is returned if the token is not passed in the header or token is expired or invalid. A new token should be obtained or refreshed.

  2. HTTP status 403 Forbidden:
    EXAMPLE:

     

    Such error is thrown when a user profile is not linked to the customer profile in the USTA system and any kind of customer-related endpoints was called, for example, https://services.usta.com/v1/customers/me
    API Client application should redirect to lightweight registration page and passing redirect url:
    https://stage2-services.usta.com/v1/register?redirect_uri={redirectUri}

    Customers can create a USTA profile there, by filling-out basic, mandatory data. When a customer clicks the “Register” button and all data is valid then the browser is redirected back to the passed redirectUri and access_token can be used against services.