Yarin Shitrit
Yarin Shitrit

Reputation: 327

Firebase Auth duplicate account when using Google/Facebook in Android

I integrated Firebase authentication in my android app.

I cannot found any way to have a unique account for email address for both google and facebook authentication. It's either I receive an error saying there is already an account using this email address if I don't allow "Allow creation of multiple accounts with the same email address" on Firebase sign in settings, or it will create 2 unique UID accounts for each login method with the same email address..

Is there a good workaround for it and manage to have 1 account with unique UID and email address for both facebook and google login methods?

Upvotes: 0

Views: 1428

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598847

What you're looking for is called account linking in Firebase terms.

In this use-case you first sign in the user with either of these providers, and then link the credentials from the other provider from the same account. So you end up with a single account, with two linked providers.

To find out what providers are linked to an email address (for example to render a UI with the sign-in options for a user), you'll want to call fetchSignInMethodsForEmail.

Upvotes: 1

Related Questions