useGrant
Access tokens

Create access token

Create a new access token for a client.

POST
/v1/providers/{providerId}/clients/{clientId}/tokens

Authorization

AuthorizationRequiredBearer <token>

In: header

Request Body

application/jsonOptional
expiresInnumber

The expiration date and time of the access token in seconds. Cannot be more than 48 hours. The shorter the duration, the more secure it is.

useJwtTypeboolean

When true, the access token header type will be set to jwt instead of at+jwt.

audienceAsArrayboolean

When true, the audience will be set as an array instead of a string.

forceDefaultDomainboolean

When true, the default domain will be used in the issuer field.

Path Parameters

providerIdRequiredstring

Unique identifier for a provider.

Format: "uuid"
clientIdRequiredstring

Unique identifier for a client.

Format: "uuid"
curl -X POST "https://sdk.usegrant.dev/v1/providers/497f6eca-6276-4993-bfeb-53cbbbba6f08/clients/497f6eca-6276-4993-bfeb-53cbbbba6f08/tokens" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "expiresIn": 0,
    "useJwtType": true,
    "audienceAsArray": true,
    "forceDefaultDomain": true
  }'

Token created successfully.

{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
  "expiresAt": "2024-01-01T00:00:00Z",
  "type": "Bearer"
}