OAuth2

Obtain an access token

Exchange an authorization code for an access token

post/oauth2/token

Request

  • Base URL
    https://oauth2.mercury.com
  • URL
    https://oauth2.mercury.com/oauth2/token
  • Auth
    HTTP basic

Request body application/x-www-form-urlencoded

codestring required

The authorization code received from the authorization server. Required when grant_type is "authorization_code".

code_verifierstring required

Required for clients with PKCE flow when using authorization code. Use together with `grant_type=authorization_code`. This is the value whose hash was sent as `code_challenge` when starting the flow.

grant_type'authorization_code' | 'refresh_token' required

The grant type for the token request. Must be "authorization_code" for the authorization code flow or "refresh_token" when refreshing an access token.

redirect_uristring required

The redirect URI that was used in the authorization request. Required when grant_type is `authorization_code`.

refresh_tokenstring required

The refresh token from the last grant if the `offline_access` scope was included. Use together with `grant_type=refresh_token`.

scopestring required

A space-separated list of the scopes requested for the access token. Required when grant_type is `refresh_token`. Must be a subset of the scopes granted during the original authorization.

Response

access_tokenstring required

The access token issued by the authorization server.

expires_ininteger

The lifetime in seconds of the access token. For example, the value "3600" denotes that the access token will expire in one hour from the time the response was generated.

refresh_tokenstring

The refresh token, which can be used to obtain new access tokens using the same authorization grant.

scopestring

The scope of the access token. A space-separated list of scopes.

token_typestring required

The type of the token issued. Value is case insensitive and should be "Bearer".

Changes

No recorded changes to this operation across all 1 revision of this API.