Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
727 views
in Technique[技术] by (71.8m points)

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?

question from:https://stackoverflow.com/questions/65887725/firebase-auth-duplicate-account-when-using-google-facebook-in-android

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...