getAccessTokenSilently slower on second login than with cleared cache
titusdecali opened this issue · 2 comments
Describe the problem
I've noticed that the second time I login (watching the network tab) there is a significant delay of 3-4 seconds before the auth0 module returns a token via getAccessTokenSilently().
This is not the case when I clear the entire browser cache and login for the first time.
What was the expected behavior?
Getting an accessToken should resolve in a short amount of time, especially in the case that it has already cached things
Reproduction
Step 1: Clear your cache, login, check the network tab to see how long it takes to get a token
Step 2: Logout, then login again and see if it takes a longer time period to return the token to getAccessTokenSilently()
Environment
- Version of
auth0-vue
used:: 1.0.2 - Version of
vue
used:: 3.2.37 - Which browsers have you tested in?: Chrome with zero extensions on both Windows and Mac. Brave is much faster in the second login than Chrome.
Hey,
Are you saying the actual HTTP call takes long, or is there something else at play?
Could you attach a HAR file for us to look into?
Important to know that getTokenSilently()
works differently when logged in vs logged out.
On top of that, it can behave differently when you are logged in, but don't have an access token.
What's happening is that getTokenSilently needs to do additional calls in those cases, resulting in longer time to take compared to calling getTokenSilently
when you are logged in and have a valid token (in that case it will be a matter of miliseconds, as it doesnt involve any HTTP call)
Thanks
I'm not sure what changed in our Auth0 settings, but I'm no longer able to reproduce this issue.
It resolves in a similar amount of time now, and (as you said) is actually faster when the cache has data, IE: After a successful login, logout, then upon re-logging in.
Just to clarify the issue when we had it, it was getting the token back (HTTP) quickly, but the internal auth0-vue
module was slow to return it in the getAccessTokenSilently()
method.
I think we had refreshToken (in auth0 settings, not local app config) turned on, so perhaps that was causing some kind of extra logic delay, though I think would slow down the HTTP part, if anything, and not the frontend module.
Closing.