Update SPA token after user updates Profile through ManagementAPI without new login

In React, we have a user profile page that uses the id token to populate fields like Name, Email, Phone.

The user can edit the fields to update them, and we are using the Management API to update the values in Auth0.

It would be great to seamlessly get a new token with the updated values and re-render the react page with the new data, but we can seem to get the updated values without forcing a login to get a new token.

Is there any way to replace the cached token with old values with a token with new values without forcing a login?

We tried getAccessTokenSilently() on success response, but it doesn’t replace the old token.


Hi @kiro

Thank you for contacting Auth0 Community.

Just for my information, what is the lifetime of your ID token ?

It is a recommended practice to let your existing token get refreshed automatically instead you are forcing to refresh. This will reduce the API calls to your tenant hence keeps your API Rate limits low.

If you are using React js and I assume some sort of data store would it be sufficient to update react store and wait for existing token to get refreshed with new values ?

If the above does not achieve your requirement then you could pass ignorecache: true to the getAccessTokenSilently method. :warning: Use this with caution and only call this when you really want to update the token otherwise if call unnecessarily can cause exceeding your tenants Rate limits.

More details are available here Search · ignorecache · GitHub

Hope it helps.



Thank you for the clarity.

1 Like

No worries!

We’re here for you!