-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expired token was received from getTokenSilently #343
Comments
One other question, in theory, getTokenSilently should always work unless the user refreshed the page? From security perspective, a user can leave the browser open, and get a valid token from getTokenSilently forever? |
@tom-zeit Thanks for raising this. I agree with your assessment that the cache should be invalidated on read as well. We're currently working on rewriting the cache for the 1.7 Beta, and so this change will more than likely happen there.
This behaviour relies on the |
@stevehobbsdev - Thanks, looking forward to this fix, any ETA on that? It's a major issue for us in production. Regarding the second part - when you say that the user have to proceed through the interactive login flow, does it mean that we should explicitly trigger that flow? or does it happen automatically when calling getTokenSilently? |
@tom-zeit Feels like a small change, I should be able to get this in this week.
Unfortunately what we're dealing with here is not an API call. To get a new token, we call the Now, I know that's not ideal given your use case and we are working on some new tools to help you in this case, but they won't be ready in the short term. |
@tom-zeit |
Description
Expired token was received from getTokenSilently.
Reproduction
Analysing auth0 logs, I see that the user hasn't made any calls to auth0 server with "Success Silent Auth" before calling the backend.
This means that an expired token was returned from the cache.
Looking on the implementation of the cache, I see that it uses setTimeout to invalidate the cache entries. This is not reliable in case that the user computer was in sleep mode:
https://stackoverflow.com/questions/6346849/what-happens-to-settimeout-when-the-computer-goes-to-sleep
I think that a better cache mechanism would be to check the cache entry validity on get, and if the entry has expired, then remove it from the cache at this point.
Environment
The text was updated successfully, but these errors were encountered: