Custom claims not in Firebase token

Viewed 37

I'm trying to set custom claims on a user, but the custom claims won't show up on the refreshed token. I'm using this in node

authResponse = getAuth().setCustomUserClaims(userId, {"admin": true})

and I'm trying to get a new token on the client with this

const resp = await auth.currentUser?.getIdTokenResult(true)

When I get the new token it does not have the custom claim that is being added. Most suggestions said making force refresh true would solve it, but not in my case. Any help would be appreciated. Not sure if there is some kind of delay between setting custom claims and when they can be used.

I've also tried await auth.currentUser?.getIdToken(true) and decoded the token using jwt.io with no luck.

0 Answers
Related