-
Notifications
You must be signed in to change notification settings - Fork 253
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
user is not updated after getAccessTokenSilently({ignoreCache: true}) #109
Comments
Hi @type - thanks for raising this We're aware of this limitation and have an item in the backlog to address it and a branch that I'll be raising a PR for in a couple of weeks (I'm away next week) In the meantime getIdTokenClaims should provide you with the updated user claims. |
Great to hear that @adamjmcgrath ! I had started on a solution with getIdTokenClaims so I'll continue down that road for now. |
Thanks, @adamjmcgrath! It's much more elegant to update the user object. I'm excited for this PR to go through. |
@adamjmcgrath Any updates on when these changes will be implemented? |
@alex-zwingli - it's on our backlog, I can't give you a specific date yet, but I'll update this post when I've raised a PR |
Describe the problem
When you refresh the access token and ignore the cache, there are potentially new claims on the user object. However, the user object is stale and there is no way to update it. auth0/auth0-spa-js#274 explains the issue and has a solution: you can call
getUser()
after you refresh the token. But we have no way to callgetUser()
.Right now, to get around this, you must hard-refresh the page.
Exposing the
getUser
function from theauth0-spa-js
client would solve this.What was the expected behavior?
The user object should have all the claims of the new token.
Reproduction
Create a rule in auth0 that sets a property e.g.
Periodically call
getAccessTokenSilently({ignoreCache: true})
without refreshing/reloading the page. Observe theuser
fromuseAuth0()
. It will not have the claim. Refreshing the page will populate the user with the claim.Environment
Version: 1.0.0
Browsers: Chrome
The text was updated successfully, but these errors were encountered: