Integrating an Authentication solution can be tough sometimes, especially when dealing with unclear error messages.
In this section, we will do our best to describes potential problems that can occur when making the request to issue a new access_token.
Fewlines Connect follows the OAuth 2.0 specification, a standardized process to authenticate Users. This process wait for specific parameters which should respect a specific format. If, at least, one of them is missing or malformed then, an error will be returned.
When it happens, the HTTP response will have a status code of 400 (Bad Request) or 401 (Unauthorized) depending on the guilty parameter(s).
In the body part of the response, we can also find an error field which contains an error code.
E.g.
HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
{
"error":"invalid_request"
}
Below is a list of possible error codes that can be returned, along with additional informations about how to resolve them.
Error Codes
-
invalid_clientWhen exchanging an
authorization_codefor anaccess_token, it’s mandatory to give the needed credentials to authenticate your Application. Having this error means that the givenclient_idand/orclient_secretfields are missing or invalid. -
invalid_grantThe given
authorization_codeorrefresh_tokenis invalid. Be sure that the token isn’t expired or revoked. Also, check ifredirect_uridoes match the one used to get theauthorization_code. -
invalid_requestWhen this error appears, it usually means that some parameter(s) are missing, had an unsupported value or are repeated. Please, check the needed parameters and their format.
-
invalid_scopeThe generated
access_tokengave an access to some informations depending on whichscopesare given in the request. Thosescopesshould be sent as a list of string, seperated by space, and should be a subset of thescopesyour Application subscribed to. (e.g. "email address phone") -
unauthorized_clientThe Application was succesfuly authenticated with the given credentials, however it isn’t allowed to use this type of grant. Be sure to use the type of grant your Application was configured for.
-
unsupported_grant_typeThe parameter
grant_typecontains an invalid value, be sure that this field is set properly. (e.g.authorization_code,refresh_token)
