From 9644800679eeeec850910817f302909cdb61188e Mon Sep 17 00:00:00 2001 From: Guillaume Bernos Date: Fri, 7 Aug 2026 10:36:18 +0200 Subject: [PATCH] docs(auth): update account-exists guidance after fetchSignInMethodsForEmail removal fetchSignInMethodsForEmail() was removed in firebase_auth 6.0.0, but the error-code docs still told users to call it to resolve account-exists-with-different-credential and email-already-in-use. Point them at signing in with an already-linked provider and then linking the original credential instead. Also removes a stray '// ignore: deprecated_member_use_from_same_package' left inside the signInWithCredential doc comment, which had split the sentence mid-clause. Fixes #12909 --- .../firebase_auth/lib/src/firebase_auth.dart | 10 ++++---- .../lib/src/auth_credential.dart | 3 +-- .../platform_interface_firebase_auth.dart | 8 +++---- .../platform_interface_user.dart | 24 +++++++++---------- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/packages/firebase_auth/firebase_auth/lib/src/firebase_auth.dart b/packages/firebase_auth/firebase_auth/lib/src/firebase_auth.dart index 3c07d4b4707a..44e892c16068 100644 --- a/packages/firebase_auth/firebase_auth/lib/src/firebase_auth.dart +++ b/packages/firebase_auth/firebase_auth/lib/src/firebase_auth.dart @@ -466,12 +466,10 @@ class FirebaseAuth extends FirebasePlugin implements FirebaseService { /// A [FirebaseAuthException] maybe thrown with the following error code: /// - **account-exists-with-different-credential**: /// - Thrown if there already exists an account with the email address - /// asserted by the credential. - // ignore: deprecated_member_use_from_same_package - /// Resolve this by asking - /// the user to sign in using one of the returned providers. - /// Once the user is signed in, the original credential can be linked to - /// the user with [linkWithCredential]. + /// asserted by the credential. Resolve this by asking the user to sign in + /// with a provider already linked to that email address. Once the user is + /// signed in, the original credential can be linked to the user with + /// [linkWithCredential]. /// - **invalid-credential**: /// - Thrown if the credential is malformed or has expired. /// - **operation-not-allowed**: diff --git a/packages/firebase_auth/firebase_auth_platform_interface/lib/src/auth_credential.dart b/packages/firebase_auth/firebase_auth_platform_interface/lib/src/auth_credential.dart index 356d5a64ae69..3d571d6822df 100644 --- a/packages/firebase_auth/firebase_auth_platform_interface/lib/src/auth_credential.dart +++ b/packages/firebase_auth/firebase_auth_platform_interface/lib/src/auth_credential.dart @@ -23,8 +23,7 @@ class AuthCredential { final String providerId; /// The authentication sign in method for the credential. For example, - /// 'password', or 'emailLink'. This corresponds to the sign-in method - /// identifier returned in [fetchSignInMethodsForEmail]. + /// 'password', or 'emailLink'. final String signInMethod; /// A token used to identify the AuthCredential on native platforms. diff --git a/packages/firebase_auth/firebase_auth_platform_interface/lib/src/platform_interface/platform_interface_firebase_auth.dart b/packages/firebase_auth/firebase_auth_platform_interface/lib/src/platform_interface/platform_interface_firebase_auth.dart index 60377db69238..6eadbd5cc45b 100644 --- a/packages/firebase_auth/firebase_auth_platform_interface/lib/src/platform_interface/platform_interface_firebase_auth.dart +++ b/packages/firebase_auth/firebase_auth_platform_interface/lib/src/platform_interface/platform_interface_firebase_auth.dart @@ -458,10 +458,10 @@ abstract class FirebaseAuthPlatform extends PlatformInterface { /// A [FirebaseAuthException] maybe thrown with the following error code: /// - **account-exists-with-different-credential**: /// - Thrown if there already exists an account with the email address - /// asserted by the credential. Resolve this by calling - /// [fetchSignInMethodsForEmail] and then asking the user to sign in using - /// one of the returned providers. Once the user is signed in, the original - /// credential can be linked to the user with [linkWithCredential]. + /// asserted by the credential. Resolve this by asking the user to sign in + /// with a provider already linked to that email address. Once the user is + /// signed in, the original credential can be linked to the user with + /// [linkWithCredential]. /// - **invalid-credential**: /// - Thrown if the credential is malformed or has expired. /// - **operation-not-allowed**: diff --git a/packages/firebase_auth/firebase_auth_platform_interface/lib/src/platform_interface/platform_interface_user.dart b/packages/firebase_auth/firebase_auth_platform_interface/lib/src/platform_interface/platform_interface_user.dart index 52a5988059e0..bc8060fd7c0b 100644 --- a/packages/firebase_auth/firebase_auth_platform_interface/lib/src/platform_interface/platform_interface_user.dart +++ b/packages/firebase_auth/firebase_auth_platform_interface/lib/src/platform_interface/platform_interface_user.dart @@ -181,9 +181,9 @@ abstract class UserPlatform extends PlatformInterface { /// user, an `email` and `credential` ([AuthCredential]) fields are also /// provided. You have to link the credential to the existing user with /// that email if you wish to continue signing in with that credential. - /// To do so, call [fetchSignInMethodsForEmail], sign in to `email` via one - /// of the providers returned and then [User.linkWithCredential] the - /// original credential to that newly signed in user. + /// To do so, sign in to `email` with a provider already linked to it, then + /// [User.linkWithCredential] the original credential to that newly signed + /// in user. /// - **operation-not-allowed**: /// - Thrown if you have not enabled the provider in the Firebase Console. Go /// to the Firebase Console for your project, in the Auth section and the @@ -227,9 +227,9 @@ abstract class UserPlatform extends PlatformInterface { /// user, an `email` and `credential` ([AuthCredential]) fields are also /// provided. You have to link the credential to the existing user with /// that email if you wish to continue signing in with that credential. - /// To do so, call [fetchSignInMethodsForEmail], sign in to `email` via one - /// of the providers returned and then [User.linkWithCredential] the - /// original credential to that newly signed in user. + /// To do so, sign in to `email` with a provider already linked to it, then + /// [User.linkWithCredential] the original credential to that newly signed + /// in user. /// - **operation-not-allowed**: /// - Thrown if you have not enabled the provider in the Firebase Console. Go /// to the Firebase Console for your project, in the Auth section and the @@ -329,9 +329,9 @@ abstract class UserPlatform extends PlatformInterface { /// user, an `email` and `credential` ([AuthCredential]) fields are also /// provided. You have to link the credential to the existing user with /// that email if you wish to continue signing in with that credential. - /// To do so, call [fetchSignInMethodsForEmail], sign in to `email` via one - /// of the providers returned and then [User.linkWithCredential] the - /// original credential to that newly signed in user. + /// To do so, sign in to `email` with a provider already linked to it, then + /// [User.linkWithCredential] the original credential to that newly signed + /// in user. /// - **operation-not-allowed**: /// - Thrown if you have not enabled the provider in the Firebase Console. Go /// to the Firebase Console for your project, in the Auth section and the @@ -368,9 +368,9 @@ abstract class UserPlatform extends PlatformInterface { /// user, an `email` and `credential` ([AuthCredential]) fields are also /// provided. You have to link the credential to the existing user with /// that email if you wish to continue signing in with that credential. - /// To do so, call [fetchSignInMethodsForEmail], sign in to `email` via one - /// of the providers returned and then [User.linkWithCredential] the - /// original credential to that newly signed in user. + /// To do so, sign in to `email` with a provider already linked to it, then + /// [User.linkWithCredential] the original credential to that newly signed + /// in user. /// - **operation-not-allowed**: /// - Thrown if you have not enabled the provider in the Firebase Console. Go /// to the Firebase Console for your project, in the Auth section and the