getTokenSilently returning expired token

getTokenSilently seems to be returning expired tokens. I think it’s because the Cache implementation uses a setTimeout to delete cached entries but setTimeout is not very reliable when the computer sleeps. So if you have a cache entry that will expire in 2 minutes, then you sleep the computer for a few minutes, upon waking up the setTimeout handler will not get called immediately and there’s a period of time where it will remain in the cache even though it has expired. Probably best to move the expiration of the cache to not rely on setTimeout but to check at time of cache retrieval.

Hi @ttb,

Welcome to the Auth0 Community Forum!

Can you post an example of the implementation you are describing?

Thanks,
Dan

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.