You can use the Refresh Token to get a new Access Token. Usually, a user will need a new Access Token only after the previous one expires or when gaining access to a new resource for the first time. It's bad practice to call the endpoint to get a new Access Token every time you call an API, and Auth0 maintains rate limits that will throttle the amount of requests to the endpoint that can be executed using the same token from the same IP.
To refresh your token, make a POST request to the /oauth/token endpoint in the Authentication API, using grant_type=refresh_token.
curl --request POST \
--url 'https://auth.unless.com/oauth/token' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'grant_type=refresh_token' \
--data 'client_id=YOUR_CLIENT_ID' \
--data 'client_secret=YOUR_CLIENT_SECRET' \
--data 'refresh_token=YOUR_REFRESH_TOKEN'
Parameter | Description |
---|---|
grant_type | Set this to 'refresh_token' |
client_id | Set this to your client ID. |
client_secret | Set this to your client secret. |
refresh_token | Use the previously obtained refresh token. |
If all goes well, you'll receive an HTTP 200 response with a payload containing a new access_token, its lifetime in seconds (expires_in), and token_type.
{
"access_token": "eyJ...MoQ",
"expires_in": 86400,
"token_type": "Bearer"
}