Auth0 React : Is it possible to get the access token expiration time without setting cacheLocation='localstorage'?

We have a requirement to track the access token expiration time and logout users if it is expired.

My initial thought was to set the tenant’s session expiry time equal to the access token expiry time. However, since we have multiple applications under the same auth0 tenant, that could affect other applications.

Another approach is to use the localStorage instead of memory as cacheLocation. But I’m worried about the security issues.

If I get the access token expiry time, I can write a logic to trigger logout manually.

What would be the correct approach? If there is anyway to retrieve the expiry time using auth0 react package, Please let me know.

1 Like