Skip to content

Centralize anonymous user upgrade and handle upgrade conflicts #734

Open

Description

@Mastersam07

Problem

Anonymous users are upgraded inconsistently

When a user who signed in anonymously then signs in with a provider, FirebaseUI should link the provider to the anonymous account so their uid and data are kept. Whether that happens currently depends on the provider and platform:

  • On mobile, most providers link the account; Apple did not until fix(ui_oauth_apple): upgrade anonymous users by linking the Apple credential #730.
  • Email/password only links on sign-up. Email link only links when upgradeAnonymousUsers is enabled.
  • On web, OAuth providers (Google, Apple, etc.) sign in as a new user instead of linking, so the anonymous user's data is lost. Phone sign-in on web links even when the signed in user is not anonymous.

Returning users can get stuck

If an anonymous user signs in with a provider account that already belongs to another user (for example, a returning user on a new device), linking fails with credential-already-in-use and the sign-in screen shows an error. The user cannot sign in with that provider while signed in anonymously, and the app has no way to recover the sign-in or merge the anonymous user's data.

Expected behaviour

  • Upgrading anonymous users behaves the same for every provider and platform.
  • When the account already exists, the app is given what it needs to sign the user in and merge the anonymous user's data, instead of a dead-end error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions