You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When receiving an IdTokenResult for a user, the claims property is of type ParsedToken. This only provides for custom claim fields with the following signature: [key: string]: string | object | undefined
But Firebase (and firebase-admin) support other types such as boolean and number. This results in confusion if you try to use a ParsedToken object as argument to match against custom claims. For example, my user can have the claim admin: true but that is invalid in a ParsedToken, you can only set admin: 'true' which does not match the boolean value.
I noticed this while using the reactfire library, as they use a ParsedToken to validate required claims.
Steps to reproduce:
1 - attempt to create a ParsedToken object with a boolean or numeric value.
Relevant Code:
constinvalidClaims: ParsedToken={admin: true,// not validscore: 500// not valid}
The text was updated successfully, but these errors were encountered:
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
When receiving an
IdTokenResult
for a user, theclaims
property is of typeParsedToken
. This only provides for custom claim fields with the following signature:[key: string]: string | object | undefined
But Firebase (and
firebase-admin
) support other types such asboolean
andnumber
. This results in confusion if you try to use aParsedToken
object as argument to match against custom claims. For example, my user can have the claimadmin: true
but that is invalid in aParsedToken
, you can only setadmin: 'true'
which does not match the boolean value.I noticed this while using the
reactfire
library, as they use aParsedToken
to validate required claims.Steps to reproduce:
1 - attempt to create a ParsedToken object with a boolean or numeric value.
Relevant Code:
The text was updated successfully, but these errors were encountered: