Skip to content

Error Messages

This section lists all possible error messages that may occur during the authentication and integration process.

Errors in Authorization Request Validation

unauthorized_client

Error:

error=unauthorized_client
error_description=The Client ID informed by the client is not valid.

Cause: The provided Client ID is not valid or not registered in the system.

Solution: Verify that the client_id is correct and was provided by Fanbase.

invalid_request - URI does not match

Error:

error=invalid_request
error_description=The informed URI does not match with any of the registered Client's URIs.

Cause: The provided redirect URI does not match any of the URIs registered for the client.

Solution: Verify that the redirect_uri exactly matches the one configured in the system. Make sure there are no differences in case, trailing slashes, or protocols.

invalid_request - id_token_hint without prompt

Error:

error=invalid_request
error_description=The use of the id_token_hint property requires the prompt value to be set as 'none'.

Cause: You used the id_token_hint parameter without setting prompt=none.

Solution: Add &prompt=none to your request when using id_token_hint.

Errors in Token Exchange Processes

Missing parameter

Error:

The request is missing a parameter: (client_id, client_secret, grant_type, code)

Cause: One or more required parameters were not provided in the request.

Solution: Verify that all required parameters are present:

  • grant_type
  • client_id
  • client_secret
  • code

Invalid Client ID

Error:

The informed Client ID is invalid.

Cause: The provided Client ID is not valid.

Solution: Verify that the client_id is correct.

Incorrect Client Secret

Error:

The informed Client Secret does not match the correct secret.

Cause: The provided Client Secret does not match the correct secret for the Client ID.

Solution: Verify that the client_secret is correct and matches the provided client_id.

Invalid authorization code

Error:

The informed authorization code is invalid.

Possible causes:

  • The authorization code has already been used
  • The code has expired
  • The code is not valid

Solution:

  • Use each authorization code only once
  • Exchange the code for tokens immediately after receiving it
  • Verify that the code was copied correctly

Invalid Grant Type

Error:

The informed Grant Type is invalid or not implemented.

Cause: The provided Grant Type is not valid or not implemented.

Solution: Use grant_type=authorization_code for the authorization code flow.

HTTP Status Codes

In addition to specific error messages, the API may return the following HTTP status codes:

CodeDescription
200Success
400Invalid request
401Unauthorized
403Access denied
404Resource not found
500Internal server error

Error Handling

JavaScript Example

javascript
try {
  const response = await fetch('{security-producao}/api/token/v2', {
    method: 'POST',
    body: new URLSearchParams({
      grant_type: 'authorization_code',
      client_id: clientId,
      client_secret: clientSecret,
      code: authorizationCode
    })
  });

  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.error_description || `Error ${response.status}`);
  }

  const tokens = await response.json();
  return tokens;
} catch (error) {
  console.error('Error exchanging code for tokens:', error.message);
  throw error;
}

Callback Example

javascript
const urlParams = new URLSearchParams(window.location.search);
const error = urlParams.get('error');
const errorDescription = urlParams.get('error_description');

if (error) {
  console.error('Authentication error:', error);
  console.error('Description:', errorDescription);
  
  switch (error) {
    case 'unauthorized_client':
      alert('Invalid Client ID. Contact support.');
      break;
    case 'invalid_request':
      alert('Invalid request: ' + errorDescription);
      break;
    default:
      alert('Unknown error: ' + errorDescription);
  }
}

Support

If you encounter errors not documented here or need additional help, contact the Fanbase support team.

Fanbase API Documentation