Token endpoint
OAuth 2.0 token endpoint for exchanging authorization codes for tokens or refreshing access tokens.
This endpoint accepts an authorization code (from the authorization endpoint) and returns access tokens, or accepts a refresh token to obtain new access tokens without user interaction.
Content-Type: This endpoint requires application/x-www-form-urlencoded.
The request body should be form-encoded, not JSON.
Grant Types:
authorization_code: Exchange authorization code for access and refresh tokensrefresh_token: Refresh an expired access token using a refresh token
Token Lifetimes:
- Access tokens expire after 14 days
- Refresh tokens expire after 60 days
Headers
Must be ‘application/x-www-form-urlencoded’.
Request
Either ‘authorization_code’ or ‘refresh_token’ depending on the flow.
The authorization code received from the authorization endpoint. Required when grant_type is ‘authorization_code’.
The refresh token from a previous token response. Required when grant_type is ‘refresh_token’.
Must match the redirect_uri used in the authorization request. Required when grant_type is ‘authorization_code’.
Response
Token lifetime in seconds (1209599 = ~14 days).
Space-separated list of granted scopes.
A JSON Web Token (JWT) that contains information about the user who authenticated with Yoco. Only included if the openid scope was requested. It can be verified using the corresponding public keys published in the JSON Web Key Set (JWKS).
The JWKS are available at the following URLs:
The JWT contains several claims, of which the following are the most relevant:
JWT.io is a useful tool for decoding and verifying JWTs.
Refresh token for obtaining new access tokens. Valid for 60 days. Only included if ‘offline_access’ scope was requested.