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
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()); }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());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).
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.
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.
- from $450App Fix TicketOne reproducible bug in an existing mobile or web app, diagnosed and fixed.See scope and start
- from $450AI-Built App RescueA Lovable, Bolt or Cursor app checked end to end in 3 days, then its worst problems fixed at a fixed price.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.See scope and start
Related: Firebase auth/account-exists-with-different-credential · Firebase auth/email-already-in-use · Firebase auth/requires-recent-login · Firebase “FIS_AUTH_ERROR”