Skip to content

Commit 2b8ae87

Browse files
committed
Address review comments and create new error code.
1 parent 27121c2 commit 2b8ae87

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

docs-devsite/auth.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ Firebase Authentication
2828
| [confirmPasswordReset(auth, oobCode, newPassword)](./auth.md#confirmpasswordreset) | Completes the password reset process, given a confirmation code and new password. |
2929
| [connectAuthEmulator(auth, url, options)](./auth.md#connectauthemulator) | Changes the [Auth](./auth.auth.md#auth_interface) instance to communicate with the Firebase Auth Emulator, instead of production Firebase Auth services. |
3030
| [createUserWithEmailAndPassword(auth, email, password)](./auth.md#createuserwithemailandpassword) | Creates a new user account associated with the specified email address and password. |
31-
| [fetchSignInMethodsForEmail(auth, email)](./auth.md#fetchsigninmethodsforemail) | Gets the list of possible sign in methods for the given email address. |
31+
| [fetchSignInMethodsForEmail(auth, email)](./auth.md#fetchsigninmethodsforemail) | Gets the list of possible sign in methods for the given email address. This method returns an empty list when \[Email Enumeration Protection\](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, irrespective of the number of authentication methods available for the given email. |
3232
| [getMultiFactorResolver(auth, error)](./auth.md#getmultifactorresolver) | Provides a [MultiFactorResolver](./auth.multifactorresolver.md#multifactorresolver_interface) suitable for completion of a multi-factor flow. |
3333
| [getRedirectResult(auth, resolver)](./auth.md#getredirectresult) | Returns a [UserCredential](./auth.usercredential.md#usercredential_interface) from the redirect-based sign-in flow. |
3434
| [initializeRecaptchaConfig(auth)](./auth.md#initializerecaptchaconfig) | Loads the reCAPTCHA configuration into the <code>Auth</code> instance. |
3535
| [isSignInWithEmailLink(auth, emailLink)](./auth.md#issigninwithemaillink) | Checks if an incoming link is a sign-in with email link suitable for [signInWithEmailLink()](./auth.md#signinwithemaillink)<!-- -->. |
3636
| [onAuthStateChanged(auth, nextOrObserver, error, completed)](./auth.md#onauthstatechanged) | Adds an observer for changes to the user's sign-in state. |
3737
| [onIdTokenChanged(auth, nextOrObserver, error, completed)](./auth.md#onidtokenchanged) | Adds an observer for changes to the signed-in user's ID token. |
38-
| [sendPasswordResetEmail(auth, email, actionCodeSettings)](./auth.md#sendpasswordresetemail) | Sends a password reset email to the given email address. |
38+
| [sendPasswordResetEmail(auth, email, actionCodeSettings)](./auth.md#sendpasswordresetemail) | Sends a password reset email to the given email address. This method does not throw an error when \[Email Enumeration Protection\](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled. |
3939
| [sendSignInLinkToEmail(auth, email, actionCodeSettings)](./auth.md#sendsigninlinktoemail) | Sends a sign-in email link to the user with the specified email. |
4040
| [setPersistence(auth, persistence)](./auth.md#setpersistence) | Changes the type of persistence on the [Auth](./auth.auth.md#auth_interface) instance for the currently saved <code>Auth</code> session and applies this type of persistence for future sign-in requests, including sign-in with redirect requests. |
4141
| [signInAnonymously(auth)](./auth.md#signinanonymously) | Asynchronously signs in as an anonymous user. |
@@ -396,7 +396,7 @@ Promise&lt;[UserCredential](./auth.usercredential.md#usercredential_interface)<!
396396

397397
## fetchSignInMethodsForEmail()
398398

399-
Gets the list of possible sign in methods for the given email address.
399+
Gets the list of possible sign in methods for the given email address. This method returns an empty list when \[Email Enumeration Protection\](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, irrespective of the number of authentication methods available for the given email.
400400

401401
This is useful to differentiate methods of sign-in for the same provider, eg. [EmailAuthProvider](./auth.emailauthprovider.md#emailauthprovider_class) which has 2 methods of sign-in, [SignInMethod](./auth.md#signinmethod)<!-- -->.EMAIL\_PASSWORD and [SignInMethod](./auth.md#signinmethod)<!-- -->.EMAIL\_LINK.
402402

@@ -600,7 +600,7 @@ export declare function onIdTokenChanged(auth: Auth, nextOrObserver: NextOrObser
600600

601601
## sendPasswordResetEmail()
602602

603-
Sends a password reset email to the given email address.
603+
Sends a password reset email to the given email address. This method does not throw an error when \[Email Enumeration Protection\](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled.
604604

605605
To complete the password reset, call [confirmPasswordReset()](./auth.md#confirmpasswordreset) with the code supplied in the email sent to the user, along with the new password specified by the user.
606606

@@ -803,7 +803,7 @@ Promise&lt;[UserCredential](./auth.usercredential.md#usercredential_interface)<!
803803

804804
Asynchronously signs in using an email and password.
805805

806-
Fails with an error if the email address and password do not match.
806+
Fails with an error if the email address and password do not match. When \[Email Enumeration Protection\](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled, this method fails with "auth/invalid-credential" in case of an invalid email/password.
807807

808808
Note: The user's password is NOT the password used to access the user's email account. The email address serves as a unique identifier for the user, and the password is used to access the user's account in your Firebase project. See also: [createUserWithEmailAndPassword()](./auth.md#createuserwithemailandpassword)<!-- -->.
809809

@@ -1611,7 +1611,7 @@ export declare function updateEmail(user: User, newEmail: string): Promise<void>
16111611
| Parameter | Type | Description |
16121612
| --- | --- | --- |
16131613
| user | [User](./auth.user.md#user_interface) | The user. |
1614-
| newEmail | string | The new email address. |
1614+
| newEmail | string | The new email address.<!-- -->Throws "auth/operation-not-allowed" error when \[Email Enumeration Protection\](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection) is enabled. Deprecated - Use [verifyBeforeUpdateEmail()](./auth.md#verifybeforeupdateemail) instead. |
16151615

16161616
<b>Returns:</b>
16171617

@@ -1829,6 +1829,7 @@ AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY: {
18291829
readonly INVALID_EMAIL: "auth/invalid-email";
18301830
readonly INVALID_EMULATOR_SCHEME: "auth/invalid-emulator-scheme";
18311831
readonly INVALID_IDP_RESPONSE: "auth/invalid-credential";
1832+
readonly INVALID_LOGIN_CREDENTIALS: "auth/invalid-login-credentials";
18321833
readonly INVALID_MESSAGE_PAYLOAD: "auth/invalid-message-payload";
18331834
readonly INVALID_MFA_SESSION: "auth/invalid-multi-factor-session";
18341835
readonly INVALID_OAUTH_CLIENT_ID: "auth/invalid-oauth-client-id";

packages/auth/src/core/errors.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const enum AuthErrorCode {
6161
INVALID_EMAIL = 'invalid-email',
6262
INVALID_EMULATOR_SCHEME = 'invalid-emulator-scheme',
6363
INVALID_IDP_RESPONSE = 'invalid-credential',
64-
INVALID_LOGIN_CREDENTIALS = 'invalid-credential',
64+
INVALID_LOGIN_CREDENTIALS = 'invalid-login-credentials',
6565
INVALID_MESSAGE_PAYLOAD = 'invalid-message-payload',
6666
INVALID_MFA_SESSION = 'invalid-multi-factor-session',
6767
INVALID_OAUTH_CLIENT_ID = 'invalid-oauth-client-id',
@@ -531,7 +531,7 @@ export const AUTH_ERROR_CODES_MAP_DO_NOT_USE_INTERNALLY = {
531531
INVALID_EMAIL: 'auth/invalid-email',
532532
INVALID_EMULATOR_SCHEME: 'auth/invalid-emulator-scheme',
533533
INVALID_IDP_RESPONSE: 'auth/invalid-credential',
534-
INVALID_LOGIN_CREDENTIALS: 'auth/invalid-credential',
534+
INVALID_LOGIN_CREDENTIALS: 'auth/invalid-login-credentials',
535535
INVALID_MESSAGE_PAYLOAD: 'auth/invalid-message-payload',
536536
INVALID_MFA_SESSION: 'auth/invalid-multi-factor-session',
537537
INVALID_OAUTH_CLIENT_ID: 'auth/invalid-oauth-client-id',

0 commit comments

Comments
 (0)