Exchange or refresh an access token
POST /api/v1/auth/token Select code sample Fetch cURL
Enrich JWT claims with user context and ensure DID key Next
Validate a credential and resolve the caller
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 audienceCommon fields
string grant_type required string refresh_tokenFor refresh token
string requested_token_type string scope string subject_tokenFor token exchange
string subject_token_type stringExample 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 stringExample 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 stringExample
{ "error": "Unauthorized", "error_description": "Invalid token"}
401
Section titled “401 ”Invalid or expired token
Media type application/json object error string error_description stringExample
{ "error": "Unauthorized", "error_description": "Invalid token"}
500
Section titled “500 ”Internal server error
Media type application/json object error string error_description stringExample
{ "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