Prerequisites
Before this page: understand account conflict resolution. Merging is the recovery path for one specific conflict — aMergeAccountsConfirmationError.
This page covers only the merging case (
MergeAccountsConfirmationError). Linking a credential can fail in other ways — the credential already belongs to an account that can’t be merged, or it’s already in use elsewhere. For the full set of conflicts and how to handle each, see account conflict resolution; use this page for the merge path only.What you’ll build
When a signed-in user adds a credential that already belongs to another mergeable account, verification throws aMergeAccountsConfirmationError. Merging folds that second account into the current one so the user ends up with a single account holding both credentials.
Two cases:
- No conflicts — the accounts don’t disagree on any profile field. You confirm and merge in one call.
- Field-level conflicts — both accounts have a value for the same field (say, a display name). The user picks which value to keep for each field, then you merge.
The merge flow
mergeConflicts. When it’s undefined there’s nothing to resolve — merge directly. When present, it lists each conflicting field with the value held by fromUser (the account being merged in) and currentUser (the signed-in account).
Completing the merge
- TypeScript
- React
Handling errors
See also
- Account conflict resolution — detecting the conflict that leads here
- Post-login user setup — where added credentials often originate