Flutter 'account-exists-with-different-credential'? The 4-Step Fix: Sign In, Then Link the Provider

By · Published 2026-11-21 · Last verified 2026-11-21

What does "account-exists-with-different-credential" mean in Flutter?

It means the email address you just signed in with already belongs to a different Firebase user that uses another sign-in method, and your project has "One account per email address" turned on. Firebase Authentication then throws the FirebaseAuthException code account-exists-with-different-credential and hands you the new credential, so you can finish the sign-in. GSPTeck is giosaia's indie studio building mobile and web apps with Flutter and Firebase, and this is the error we see when someone signs in with Google after registering with Facebook or a password under the same email. Checked against the Firebase Authentication docs on 2026-11-21.

Grid of the 4-step method for a Flutter account-exists-with-different-credential error: catch the error code, keep the email and pending credential, sign in with the provider that owns the email, then call linkWithCredential, without turning off the One account per email address setting
The 4-step Link After Conflict method.

Why does Firebase refuse the second sign-in?

Because the "One account per email address" setting in the Firebase console stops two different providers from creating two users for one email. The error is a deliberate stop, not a bug: the user must prove they own the existing account first, then you attach the new provider to it.

What you seeWhat the Firebase docs sayWhat to do
account-exists-with-different-credentialThrown when a user signs in with a provider using an email that already exists for another Firebase user's provider, with the setting enabled; the exception carries an AuthCredentialKeep the credential, sign in with the existing provider, then link
e.email and e.credentialThe docs sample reads the conflicting email and the pending credential from the exceptionStore both in memory only for this one flow
provider-already-linkedThrown by linkWithCredential() when the provider is already linked to the userNothing to link; the user is already set
credential-already-in-useThe account for that credential already exists, or is already linked to a Firebase userDo not link; sign in to the account that owns it
invalid-credentialThe provider's credential is not validRequest a fresh token from the provider and retry
Two columns of Firebase link error codes: provider-already-linked, invalid-credential and account-exists-with-different-credential handled in the flow, and credential-already-in-use meaning another user owns the credential so you sign in to that account instead
Which link codes you handle, and which mean stop.

The 4-step Link After Conflict method

This is the Link After Conflict method: catch the error, keep the pending credential, sign in with the provider that already owns the email, then link the new provider. Do the steps in this order and never try to create a second account for the same email.

  1. Catch the exact code. Wrap the sign-in in try and on FirebaseAuthException catch (e), then compare e.code with 'account-exists-with-different-credential'. Print e.code and e.message first, because other codes such as too-many-requests or operation-not-allowed need different fixes.
  2. Keep the pending credential. Read e.email and e.credential from the exception. The credential is the new provider's proof, for example the Google ID token the user just produced. Hold it in a local variable; do not write it to disk.
  3. Sign in with the provider that already owns the email. Tell the user which method they used before, then run that provider's normal sign-in: ask for the password for an email-and-password account, or open the Facebook flow if that was the original provider. The Firebase sample does this by looking up the sign-in methods for the email and treating the first one as the recommended method.
  4. Link the pending credential. Call linkWithCredential(pendingCredential) on the signed-in user. When it succeeds, Firebase says the user can sign in with any linked provider and reach the same Firebase data. Handle provider-already-linked, invalid-credential and credential-already-in-use explicitly.

The same studio's note on the requires-recent-login error and reauthentication covers the next problem you may hit after linking. For provider setup that quietly breaks on release builds, see the Google Sign-In release SHA-1 fix for Play builds.

What the user sees, and what you should say

A raw error code is useless to a user, so turn it into one plain sentence and one button. For example: "You already have an account with this email using Facebook. Sign in with Facebook once and we will connect Google for next time." The screen should name the original provider, offer only that provider's sign-in, and link automatically afterwards. It should not ask the user to type their email again, because you already hold it in e.email.

Keep the flow honest about its limits. The docs sample uses a lookup of sign-in methods that returns a list; if you do not get a usable list, fall back to a generic "sign in with the method you used before" screen rather than guessing. Do not write code that turns off "One account per email address" to make the error disappear. That setting is what prevents two separate user records, and two records with separate data are harder to clean up than one extra tap.

Four-step sequence for a Flutter sign-in conflict: try Google and get the error, sign in with the original provider, link the pending credential, then any linked provider signs in
Sign in with the old provider, then link the new one.

A worked example: password first, then Google

Illustrative scenario. Maya registers in your app with an email and a password. Weeks later she taps "Continue with Google" on a new phone, using the same email. Your sign-in code receives account-exists-with-different-credential with her email and the Google credential attached. Your screen says she already has an account that uses a password, asks for it, signs her in with signInWithEmailAndPassword, and then links the held Google credential. From then on either method opens the same account and the same Firestore data. If instead you had called signInWithCredential again with the same Google credential, you would only have reproduced the error.

Mistakes that keep the error coming back

Most repeat failures come from three habits: retrying the same sign-in, throwing away the credential, or hiding the provider choice from the user. On newer projects the sign-in method lookup may return nothing; see why invalid-credential replaces wrong-password under email enumeration protection.

Where this fits in a Flutter and Firebase app

Account linking is a small piece of a bigger release routine: provider setup, rules, App Check and a Play release that signs correctly. If you are working through a launch, our Flutter and Firebase release checklist for Google Play is the wider list, and Firebase Auth API key abuse hardening covers the security side of sign-in. You can see who builds these apps and where the official links live on the GSPTeck apps and official links page, or start at the GSPTeck homepage.

FAQ

Is account-exists-with-different-credential an error I should prevent?

No. It is the expected result when the setting "One account per email address" is on and an email already has an account under another provider. You handle it by signing in with the existing provider and linking, not by suppressing it.

Does linking merge two separate Firebase users?

No. Linking attaches a new provider to the user who is already signed in. If the other provider already has its own separate Firebase user, credential-already-in-use can be thrown, and you must sign in to the account that owns that credential instead.

Can I link without asking the user to sign in again?

Not for the conflict case. Firebase's documented flow requires the user to sign in to the existing provider first and then link the pending credential, so the person proves they own the account that holds that email.

What else can break sign-in besides this error?

Firebase's error-handling page also names too-many-requests, which appears when you hit the Authentication quota, and operation-not-allowed, which appears when a provider is not enabled. Read e.code before choosing a fix.

Sources

Vertical Pinterest graphic with five steps for fixing the Firebase account-exists-with-different-credential error in Flutter
Pinterest pin: account-exists-with-different-credential in Flutter.