Skip to content

ClaimsCheck throwing TypeError: Cannot read property 'claims' of undefined #325

@thomasmburke

Description

@thomasmburke

Version info

React: ^16.14.0

Firebase: 8.2.1

ReactFire: 3.0.0-rc.0

Steps to reproduce

Seems to happen with any AuthCheck that uses the requiredClaims param or by calling ClaimsCheck directly

<AuthCheck fallback={<Home />} requiredClaims={{admin: true}}>
    <Admin />
</AuthCheck>}

Expected behavior

Users with custom claims should pass the AuthCheck or ClaimsCheck and fallback to the fallback argument

Actual behavior

Receiving error: TypeError: Cannot read property 'claims' of undefined

image

Debugging in Chrome Dev tools indicates that the useObservable call may have an unresolved promise? I'm guessing this because _useIdTokenResult has a status of "loading" and isComplete is false.

image

Additionally, when I expand the user variable that I have blacked out I can see that it successfully is getting my authenticated user, meaning I can see the email, displayName, and custom claims when inspecting the JWT token. The same <AuthCheck> call works if I omit the requiredClaims param.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions