Skip to content

Firebase Auth errorFirebase: “User can only be linked to one identity for the given provider” (auth/provider-already-linked)

linkWithCredential, linkWithPopup or linkWithPhoneNumber fails with auth/provider-already-linked. A Firebase user can have one account per provider: one Google account, one phone number, one password. The user you are linking to already has that provider, even if it is a different Google account or phone number.

Short answer

Check the user’s providerData before you offer to link, and hide the option for providers they already have. To switch to a different account of the same provider, unlink the old one first, then link. To change a phone number, use updatePhoneNumber instead of linking.

Why Firebase refuses the link, and the fix

  1. 01

    The provider is already on this user

    “Thrown if the provider has already been linked to the user.” Firebase, firebase.User (linkWithCredential)

    The app offers “Connect Google” to a user who already signed in with Google, or runs the link step twice. Read providerData and only link providers that are missing, and run the link once, not in an effect that can fire twice. In Flutter the code is provider-already-linked, without the auth/ prefix.

    const linked = auth.currentUser.providerData.map((p) => p.providerId);
    if (!linked.includes('google.com')) {
      await linkWithPopup(auth.currentUser, new GoogleAuthProvider());
    }
  2. 02

    Switching to a different account of the same provider

    “This error is thrown even if this is not the same provider's account that is currently linked to the user.” Firebase, firebase.User (linkWithCredential)

    Linking a second Google account, or a new phone number, fails even though it is a different account. Unlink the provider, then link the new one. Warn the user first: after unlinking they can no longer sign in with the old account, and signing in with it again creates a new, separate Firebase user.

    await unlink(auth.currentUser, 'google.com');
    await linkWithPopup(auth.currentUser, new GoogleAuthProvider());
  3. 03

    Changing a phone number

    linkWithPhoneNumber adds a phone provider; it cannot replace one. To change the number, verify the new one and call updatePhoneNumber with the phone credential. It may need a recent sign-in first (auth/requires-recent-login).

  4. 04

    Adding a password the user already has

    Linking an email and password credential to a user who already has a password fails the same way. Use updatePassword to change it instead; it may also need a recent sign-in first.

  5. 05

    Reading the message in your app

    “User can only be linked to one identity for the given provider.” GitHub, firebase-js-sdk auth error messages

    The web SDK’s message is short. Catch the code and tell the person the account is already connected.

Checked against the vendor’s docs on : Firebase reference: firebase.User error codes; Firebase docs: Link multiple auth providers; firebase-js-sdk: auth error messages.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

Related: Firebase auth/account-exists-with-different-credential · Firebase auth/email-already-in-use · Firebase auth/requires-recent-login · Firebase “FIS_AUTH_ERROR”

Questions

More on this error

How is this different from auth/credential-already-in-use?

provider-already-linked means the user you are linking to already has that provider. credential-already-in-use means the credential belongs to another Firebase user, so the accounts need merging instead.

Can one user have two Google accounts?

No. A Firebase user has one identity per provider, so a second Google account has to be its own user.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.