Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auth0 - Disable user profile cache

How to disable user profile cache in Auth0?

I have been able to update the user profile user_metadata. But the problem is, that Auth0 caches user profile, so this update will only be seen after user has been log out and then log in again. This is a problem because I don't want to always force users to log in everytime they open my application. I want that the application would remember the session, but still query userinfo data when the application open. The caching makes this impossible.

Obviously this is due to the auth0 cache as documented in “User Profile: In-Depth Details”.

However, that same document states “You may delete a user’s cached profile via the Auth0 Dashboard or the Management API.” I wish to delete the userinfo cache (ideally for the specific user) when user_metadata is updated, but I have been unable to find any information in the Management API for how to delete the userinfo cache.

like image 380
Ville Miekk-oja Avatar asked Oct 27 '18 13:10

Ville Miekk-oja


1 Answers

The same problem is discussed in this Github issue: https://github.com/auth0/auth0-spa-js/issues/274

The tl;dr is: working around this problem by reloading the entire SPA by user https://github.com/patricknee

and the auth0 engineer gives these instructions: Right now, if you want to refresh the ID token, you would have to call getTokenSilently({ ignoreCache: true }) first to refresh the cache. getIdTokenClaims() just returns what it already knows about the token and does not refresh it, as you've observed.

"Disable user profile cache" would force the user to re-login on every request so I don't think that's possible.

like image 83
DavidWeiss2 Avatar answered Nov 17 '22 15:11

DavidWeiss2