Requesting Custom Claims on your Access Token
You can now add your own custom fields on the access token that your receive from Cotter
Last updated
You can now add your own custom fields on the access token that your receive from Cotter
Last updated
Let's say you have a user with attributes:
And you want to include this in Cotter's Access Token so that you can quickly access them in your API Middleware, you can now do this by calling an API request.
POST
https://www.cotter.app/api/v0/token/custom
Add Custom Claims to Cotter's original Access Token that you get when the user logs in.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
When you called this API with a refresh_token
, the returned refresh_token
can be used to generate new access_token
and id_token
that have the custom claims. This custom claims also persists through refresh token rotation that originates from the refresh_token
that you receive from this API call.
To use this with the JS SDK, you can update the refresh_token
stored in the user's browser using the JS SDK: Update Refresh Token (for Custom Claims)
API_KEY_ID
string
Your API Key ID
API_SECRET_KEY
string
Your API Secret Key
Content-Type
string
application/json
refresh_token
string
A valid refresh token. If given, this endpoint will return a special refresh token where if used, will return access token and id token that have the custom attributes.
custom_attributes
object
a Dictionary of custom attributes that you want to add to the original token
token
string
Cotter's original access token (or id token)