Exchange the Amazon authorization code
To make an access token request, your app backend sends a POST request to the LWA token endpoint (https://api.amazon.com/auth/o2/token) with the authorization code, client ID, and client secret. If your app backend supports PKCE, include the code_verifier in the query string.
HTTP request
HTTP response
On success, the LWA token server returns a JSON response with the Amazon access token.Example access token request
The following example shows an access token request. In this example, the app exchanges the user’s Amazon authorization code for an Amazon access token.Errors
If an error occurs exchanging the Amazon authorization code for the Amazon access token, the Amazon token server responds withHTTP Status 400 and the JSON response body includes an error parameter, as described by the OAuth 2.0 specification. For details about why the request to obtain the Amazon access token failed, check the error_description parameter of the JSON response and the OAuth 2.0 specification description for that error code.
| Error code | Message to show to user | Possible causes |
|---|---|---|
| invalid_request | We are experiencing a problem connecting with Alexa to link your account. Please try again later. | Missing client_id, client_secret, grant_type, and/or code |
| invalid_client | We are experiencing a problem connecting with Alexa to link your account. Please try again later. | Invalid client_id and/or client_secret |
| invalid_grant | We are experiencing a problem connecting with Alexa to link your account. Please try again later. | The request’s code (Amazon authorization code) or the code verifier isn’t valid. |
| unauthorized_client | We are experiencing a problem connecting with Alexa to link your account. Please try again later. | The provided client_id doesn’t have permission to request consent to link the user’s account |
| unsupported_grant_type | We are experiencing a problem connecting with Alexa to link your account. Please try again later. | The request’s grant_type isn’t authorization_code |

