Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expose INVALID_LOGIN_CREDENTIALS as auth/invalid-credential error. #7772
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
Expose INVALID_LOGIN_CREDENTIALS as auth/invalid-credential error. #7772
Changes from 4 commits
9291d5c
9fc20d6
dad5284
88cc8a6
0e7aed9
89f01c0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a period here. Based on the other Deprecated things in this document, I think it should be 'Deprecated.'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "auth/invalid-login-credentials", the missing code reported in #7661?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are reusing the existing error code 'auth/invalid-credential' since it is very similar to the backend error and is already public on the SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason not to create a new error type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using firebase 10.6.0 and it is returning
auth/invalid-login-credentials
when there is an incorrect username or password. Will this change to start returningauth/invalid-credential
in later updates?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct. It is currently converting the server error "INVALID_LOGIN_CREDENTIALS" to lower-case and sending that error code -
firebase-js-sdk/packages/auth/src/api/index.ts
Line 204 in bebecda
We will now populate the error map so the server error maps to "auth/invalid-credential"
This is to avoid creating another error code that is very similar to the existing invalid-credential code and to be consistent across iOS, Android and Web. On Android, we are reusing the https://firebase.google.com/docs/reference/android/com/google/firebase/auth/FirebaseAuthInvalidCredentialsException rather than create a new one, so following a similar approach on Web. Do you see any issue with this approach?
Changing behavior from auth/invalid-login-credentials (a non-exposed error code) to auth/invalid-credential (a public error code) can be a breaking change, but i am not sure, since the previous error code was not public. WDYT @DellaBitta ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good reason to me. Thanks for the clarification!