Skip to content
English
  • There are no suggestions because the search field is empty.

Exchange or refresh an access token

POST /api/v1/auth/token Select code sample Fetch cURL
const url = 'https://localhost:8080/api/v1/auth/token';const options = {  method: 'POST',  headers: {'Content-Type': 'application/json'},  body: '{"audience":"example","grant_type":"example","refresh_token":"example","requested_token_type":"example","scope":"example","subject_token":"example","subject_token_type":"example"}'};
try {  const response = await fetch(url, options);  const data = await response.json();  console.log(data);} catch (error) {  console.error(error);}
curl --request POST \  --url https://localhost:8080/api/v1/auth/token \  --header 'Content-Type: application/json' \  --data '{ "audience": "example", "grant_type": "example", "refresh_token": "example", "requested_token_type": "example", "scope": "example", "subject_token": "example", "subject_token_type": "example" }'

Issue an enriched access token (and rotated refresh token) via OAuth 2.0 Token Exchange (RFC 8693) or refresh-token grant

Request Body

Section titled “Request Body ”

Token request

Media type application/json object audience

Common fields

string grant_type required string refresh_token

For refresh token

string requested_token_type string scope string subject_token

For token exchange

string subject_token_type string
Example generated
{  "audience": "example",  "grant_type": "example",  "refresh_token": "example",  "requested_token_type": "example",  "scope": "example",  "subject_token": "example",  "subject_token_type": "example"}

Responses

Section titled “ Responses ”

200

Section titled “200 ”

Token response

Media type application/json object access_token string expires_in integer issued_token_type string refresh_expires_in integer refresh_token string scope string token_type string
Example generated
{  "access_token": "example",  "expires_in": 1,  "issued_token_type": "example",  "refresh_expires_in": 1,  "refresh_token": "example",  "scope": "example",  "token_type": "example"}

400

Section titled “400 ”

Invalid request

Media type application/json object error string error_description string
Example
{  "error": "Unauthorized",  "error_description": "Invalid token"}

401

Section titled “401 ”

Invalid or expired token

Media type application/json object error string error_description string
Example
{  "error": "Unauthorized",  "error_description": "Invalid token"}

500

Section titled “500 ”

Internal server error

Media type application/json object error string error_description string
Example
{  "error": "Unauthorized",  "error_description": "Invalid token"}
Previous
Enrich JWT claims with user context and ensure DID key
Next
Validate a credential and resolve the caller