Skip to content
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

useIdTokenResult forceRefresh not working? #380

Open
dennemark opened this issue May 31, 2021 · 3 comments
Open

useIdTokenResult forceRefresh not working? #380

dennemark opened this issue May 31, 2021 · 3 comments

Comments

@dennemark
Copy link

Version info

React: 17 experimental with suspense

Firebase: 8.6.2

ReactFire: 3.0.0-rc.0

Other (e.g. Node, browser, operating system) (if applicable):

Test case

I am using nextjs and reactfire. I am setting auth claims on one page and using the normal query, I get new claims. Afterwards I switch the page.

let token = await user.getIdTokenResult(true)
console.log(token.claims) // { claim: NewClaim }
router.push("/newpage")

Now on the new page, I can get the new claims via the above command and it shows me the new claim, too.
However, using the reactfire hook, I am still getting old ones:

const { data: token} = useIdTokenResult(user, true);
console.log(token.claims) // { claim: OldClaim }

Expected behavior

Normally the useIdTokenResult should give back the updated claim.

Actual behavior

The useIdTokenResul keeps showing the old claim.

What I am trying to achieve is a claim update as described in the experimental firebase extension Auth Claims: https://github.com/FirebaseExtended/experimental-extensions/blob/next/firestore-auth-claims/POSTINSTALL.md#activating-new-custom-claims

@Haqverdi
Copy link

Haqverdi commented Jun 4, 2021

Same issue

@capybarahero
Copy link

capybarahero commented Aug 9, 2023

@hamiltonchua
Copy link

I am seeing this as well with latest version v4.2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants