Handling the Callback
After the user authenticates, they are redirected back to your application with an authorization code.
Steps:
Retrieve Authorization Code and State: Extract these from the query parameters.
Verify State: Ensure the state matches the one you generated earlier.
Exchange Authorization Code for Tokens: Send a POST request to the token endpoint to exchange the authorization code for ID, access, and refresh tokens.
Example Callback Handling:
Token Request Parameters
Parameter | Description |
---|---|
| The type of grant being requested. For authorization code flow, use |
| The authorization code received from the authorization endpoint. |
| The URI to which the response will be sent. It must match the redirect URI registered with the client. |
| The client ID you obtained during client registration. |
| The PKCE code verifier. |
Example Token Request Body
Token Response Fields
Field | Description |
---|---|
| The token that can be used to access protected resources. |
| A JWT that contains user identity information. |
| A token that can be used to obtain new access tokens. |
| The type of token issued. Typically |
| The duration in seconds for which the access token is valid. |
Example Token Response
Last updated