Token Exchange
Exchange an authorization_code or a refresh_token for an access token.
Authentication
This endpoint requires the Client ID and Client Secret. The preferred way to send them is the Basic Auth strategy:
- Join the Client ID and Client Secret with a single colon:
"{ClientID}:{ClientSecret}" - Base64 encode this string:
base64("{ClientID}:{ClientSecret}") - Construct the Authorization header:
"Authorization: Basic {base64EncodedDigest}"
For example, the Client ID test-client-id and Client Secret test-secret-value give Authorization: Basic dGVzdC1jbGllbnQtaWQ6dGVzdC1zZWNyZXQtdmFsdWU=.
Alternatively, send them as client_id and client_secret in the body. If you send both the header and the body parameters, they must match.
application/x-www-form-urlencoded- body
grant_type*"authorization_code""authorization_code"code*stringThe authorisation code from the callback endpoint
length <= 2048redirect_uri?stringRequired when more than one Redirect URL is registered for the client. When sent, it must match the redirect_uri of the Authorisation Request.
urilength <= 2048client_id?stringThe Client ID, when authenticating with client_id and client_secret in the body instead of the Authorization header. If both are sent, they must match.
length <= 64client_secret?stringThe Client Secret, when authenticating in the body instead of the Authorization header, which is preferred. If both are sent, they must match.
length <= 2048The credentials for the integration. Store them securely: if they are lost or revoked, the user has to authorise the integration again.
application/json- response
access_token*stringThe access_token for this integration
token_type*"Bearer"The type of the access_token
"Bearer"expires_in?numberThe number of seconds before the access_token expires
refresh_token?stringThe refresh_token for this integration
curl -X POST "https://example.com/oauth2/token" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d 'grant_type=authorization_code&code=string'{ "access_token": "string", "token_type": "Bearer", "expires_in": 0, "refresh_token": "string"}