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

Refactor AuthProvider to throw original error #278

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

qbantek
Copy link
Contributor

@qbantek qbantek commented May 17, 2023

Refactors the AuthProvider to throw the original error instead of a generic 'Login error: invalid credentials' error when dealing with Multi-Factor users.

This allows access to the error code and resolver needed for MFA sign ins.

References:
https://firebase.google.com/docs/reference/node/firebase.auth.multifactorerror https://firebase.google.com/docs/auth/web/multi-factor#signing_users_in_with_a_second_factor

Refactors the AuthProvider to throw the original error instead of a
generic 'Login error: invalid credentials' error.

This provides more specific error messages to the user. Specifically, it
allows access to the error code needed for MFA sign ins.

References:
https://firebase.google.com/docs/reference/node/firebase.auth.multifactorerror
https://firebase.google.com/docs/auth/web/multi-factor#signing_users_in_with_a_second_factor
Update the AuthProvider.ts to handle multi-factor authentication while
maintaining previous behaviour for all other errors.

If the error code is 'auth/multi-factor-auth-required', it logs the
second factor challenge required and throws the error. Otherwise, it
logs the invalid credentials and throws a generic error message.
@qbantek
Copy link
Contributor Author

qbantek commented May 30, 2023

@benwinding please let me know if you need any other elements to consider merging this PR. I would be glad to write some documentation around the MFA scenario or adding an example if needed. Thanks!

@qbantek qbantek mentioned this pull request May 31, 2023
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

Successfully merging this pull request may close these issues.

None yet

1 participant