Closed sparkonium closed 3 years ago
I don't understand : You want refresh token when you click on a button ? If yes :
const actions = {
refreshToken() {
this.$fire.auth.currentUser.getIdToken(true)
},
}
And call action when you click on button
I hope to help you
I have see the context on precedent issue,
Personally, when I execute getIdToken
. It's when I execute firebase function and I know the change applied on claims
Not event launch onAuthStateChanged
(who set claims with set mutation)
I actualize my userClaims
data in store/state with update mutation
Conclusion: I use 2 different mutations for set and update my user claims.
And I call manually the update claims mutation
I hope to help you,
If you find better solution for update it automatically, I am interesting :)
Hey @tibs245
As far as I know this is the only way to do it... but could be wrong.
Closing for now.
br, Pascal
When there are changes to user custom claims, tokens must be refreshed as per: https://firebase.google.com/docs/auth/admin/custom-claims#propagate_custom_claims_to_the_client
How could we manually call the action
onAuthStateChanged
on mount or from a button on a page to refresh the ID Token? We tried passingthis.$fire.auth.currentUser
but it did not work.We would like to rewrite another Action/Store logic and to reuse if possible.