Skip to main content

Use Token

The Use Token endpoint exchanges the authorization code you received from a Use AgeKey request (when using the agekey-upgrade scope and all age thresholds are false) for an access token. This access token is used to authorize the upgrade request.

OAuth 2.0 Specification

This endpoint implements the OAuth 2.0 Token Endpoint for authorization code exchange.

Token endpoint

curl -X POST "https://api.agekey.org/v1/oidc/use/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Authorization: Basic <base64(client_id:client_secret)>" \
-d "grant_type=authorization_code" \
-d "code=your-authorization-code"

Headers

HeaderValueRequired
Content-Typeapplication/x-www-form-urlencodedYes
AuthorizationBasic <base64(client_id:client_secret)>Yes

Body

PropertyTypeRequiredDescription
grant_typestringYesAlways set to authorization_code
codestringYesThe authorization code returned from the Use AgeKey request when using agekey-upgrade scope and all thresholds are false

Response

On success, returns an object with the access_token property. This access token can be used to authorize the upgrade request to the /v1/agekey/upgrade endpoint.

{
"access_token": "eyJhbGc...",
"token_type": "Bearer",
"expires_in": 3600
}
warning

Important: The access_token expires in 3600 seconds (1 hour). You should use it promptly for the upgrade request.