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

Never throw when verifying ID token #366

Closed
kmjennison opened this issue Dec 13, 2021 · 0 comments · Fixed by #368
Closed

Never throw when verifying ID token #366

kmjennison opened this issue Dec 13, 2021 · 0 comments · Fixed by #368
Assignees
Labels
breaking The issue or PR will introduce a breaking change enhancement New feature or request

Comments

@kmjennison
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently, the SSR logic might throw if it's unable to verify the user's ID token. This is frustrating because it's not particularly easy for developers to catch errors in withAuthUserSSR/withAuthUserTokenSSR, and in most cases an unauthed user + optional error log is preferable to a 500 error. It would be better if the error didn't throw or was otherwise easily catchable.

#361 handles more of the common Firebase errors but still throws unhandled errors.

Describe the solution you'd like and how you'd implement it

Don't throw when verifying the user's ID token server-side. Instead, return an unauthenticated user for any error, then call an optional onServerSideAuthError callback provided by the developer for the unexpected errors (ones we don't handle above).

Is this a breaking change?

Yes, a minor one, for developers that are expecting thrown errors from withAuthUserSSR or withAuthUserTokenSSR

Describe alternatives you've considered

None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking The issue or PR will introduce a breaking change enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant