Skip to content

docs(auth): clarify fetchSignInMethodsForEmail behavior with email enumeration protection #8518

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

Merged
merged 2 commits into from
May 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions packages/auth/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2096,18 +2096,27 @@ export namespace FirebaseAuthTypes {
/**
* Returns a list of authentication methods that can be used to sign in a given user (identified by its main email address).
*
* ⚠️ Note:
* If "Email Enumeration Protection" is enabled in your Firebase Authentication settings (which is the default),
* this method may return an empty array even if the email is registered, especially when called from an unauthenticated context.
*
* This is a security measure to prevent leaking account existence via email enumeration attacks.
* Do not use the result of this method to directly inform the user whether an email is registered.
*
* #### Example
*
* ```js
* const methods = await firebase.auth().fetchSignInMethodsForEmail('[email protected]');
*
* methods.forEach((method) => {
* console.log(method);
* });
* if (methods.length > 0) {
* // Likely a registered user — offer sign-in
* } else {
* // Could be unregistered OR email enumeration protection is active — offer registration
* }
* ```
*
* @error auth/invalid-email Thrown if the email address is not valid.
* @param email The users email address.
* @param email The user's email address.
*/
fetchSignInMethodsForEmail(email: string): Promise<string[]>;

Expand Down
Loading