Skip to content

feat(auth): onUpgradeFailure callback when account linking fails#1355

Open
russellwheatley wants to merge 6 commits intomainfrom
issue-1354-auto-upgrade-anon-user
Open

feat(auth): onUpgradeFailure callback when account linking fails#1355
russellwheatley wants to merge 6 commits intomainfrom
issue-1354-auto-upgrade-anon-user

Conversation

@russellwheatley
Copy link
Copy Markdown
Member

@russellwheatley russellwheatley commented May 6, 2026

  • Adds an onUpgradeFailure callback for anonymous user auto-upgrade failures.
  • Allows apps to handle account-linking conflicts and suppress the default FirebaseUI error by returning "handled".
  • Preserves anonymous user upgrade state correctly across provider redirect flows.
  • Adds tests for credential, provider, failure-handling, and redirect upgrade behavior.

closes #1354

Below demonstrates onUpgradeFailure firing when auto upgrade anonymous user fails and also returns "handled" so error message does not appear in the UI.

Screen.Recording.2026-05-07.at.16.47.44.mov

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an onUpgradeFailure callback to the anonymous upgrade behaviors, allowing for custom error handling and suppression during the linking process. The changes include new type definitions, a centralized error handling utility, and updated logic for both credential and provider linking handlers. A critical issue was identified in the provider linking implementation where the unconditional removal of the user ID from local storage in a finally block would disrupt the redirect flow.

Comment thread packages/core/src/behaviors/anonymous-upgrade.ts Outdated
@russellwheatley russellwheatley requested a review from dackers86 May 6, 2026 14:55
@russellwheatley russellwheatley marked this pull request as ready for review May 6, 2026 14:55
@russellwheatley
Copy link
Copy Markdown
Member Author

I think I'd like to get some integration tests setup for this before going further with this PR as there are some changes to core behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autoUpgradeAnonymousUsers onUpgrade event not invoked if merge is required.

1 participant