How to change the expires_in value of Access Token at Auth0's SPA SDK

Problem statement

We are using the getTokenSilently() method in auth0-spa-js to get an access token and saving it to memory. What we would like to do is to set expires_in value to 3600 seconds.

Is there a way to change the expiration date(expires_in value) of the Access Token?

Cause

  • Making a request to the /authorize endpoint without an audience query parameter causes opaque access tokens that have a default lifetime (expires_in value).

Solution

We recommend making an /authorize request granting access to your API. Then, in your API’s Token Settings, you can set your preferred Token Expiration (Seconds) values.

Reference Materials

1 Like