logo
OpenapiAuth

Exchange an authorization code

API Docs with browser client
POST
/auth/oauth/token

Exchange an authorization code (from the redirect) plus the PKCE code verifier for the account JWT. Single-use; verifies the code is bound to the same client_id and redirect_uri.

Authorization

headerx-api-key<token>

Request Body

application/json
  1. body

Exchange an authorization code (+ PKCE verifier) for the account JWT.

code*string

Authorization code received on the redirect_uri.

Length1 <= length <= 512
codeVerifier*string

PKCE code verifier matching the codeChallenge from authorize.

Match^[A-Za-z0-9._~-]{43,128}$
clientId*string

The client_id the authorization code was issued for.

Length1 <= length <= 2048
redirectUri*string

The redirect_uri the authorization code was issued for.

Formaturi
resource?string

Optional RFC 8707 resource indicator. When provided it must match the resource the authorization code was issued for; the minted JWT is already bound to that resource.

Formaturi
Lengthlength <= 2048

Response Body

OK

application/json
  1. response

The minted account JWT and minimal user details.

token*string

JWT to send as an Authorization: Bearer credential.

Length1 <= length
tokenType*unknown
expiresAt*string

ISO timestamp after which the token expires.

Formatdate-time
user*

Minimal user details delivered alongside an approved token.

Example Request
curl -X POST 'https://example.com/v4/auth/oauth/token' \  -H 'Content-Type: application/json' \  -d '{  "code": "string",  "codeVerifier": "string",  "clientId": "string",  "redirectUri": "http://example.com"}'
Example Response
{  "token": "string",  "tokenType": "Bearer",  "expiresAt": "2019-08-24T14:15:22Z",  "user": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "primaryEmail": "string",    "walletAddress": "string"  }}