Requesting Custom Claims on your Access Token
You can now add your own custom fields on the access token that your receive from Cotter
Use Case
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.
Request Custom Claims on Cotter's Access Token
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.
Headers
Request Body
Example Request
Persisting the Custom Claims
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)
Try it out at JWT.io
Request Body with the Original Access Token
Response with the new Custom Attributes
Last updated