react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

Google sign in replaces other auth providers when linked

Open mikehardy opened this issue 3 years ago • 3 comments

Discussed in https://github.com/invertase/react-native-firebase/discussions/5897

Originally posted by MarioUnlam December 1, 2021 I'm working on an app that allows the user to sign in with Google, Facebook and Twitter. I noticed that if the user signs in with one auth provider, and then tries to use another, signInWithCredential() will return an 'account-exists-with-different-credential' exception. I already managed to handle this exception for the three auth providers, so the user has to authenticate using the previous provider to link the new one.

However, this only happens if the new auth provider is NOT google. If the user authenticates with Facebook or Twitter first, and then uses Google, it won't throw an exception, and instead it unlinks the previous providers, leaving that account with Google as the only provider. Is this a bug? because it looks quite inconsistent, the other providers work differently. Is there any way to disable this behavior?

mikehardy avatar Dec 02 '21 18:12 mikehardy

reproducible with react-native-firebase-authentication-example

mikehardy avatar Dec 02 '21 18:12 mikehardy

From the other issue:

In the meantime, a possible workaround would be to run fetchSignInMethodsForEmail(...) every time a user tries to sign in with Google, and if it returns more than one provider, run the same logic used to handle "account-exists-with-different-credential" exceptions. I'm pretty sure this is a very unlikely scenario (a user signing in to the same app, using the same email, but a different provider, and in this specific order).

mikehardy avatar Dec 02 '21 18:12 mikehardy

Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 18 '22 18:04 stale[bot]

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

github-actions[bot] avatar Dec 05 '22 19:12 github-actions[bot]

This is still an issue, do we not have any way to link accounts together?

duke-darius avatar Jan 16 '23 14:01 duke-darius

This is still an issue.

bofeiw avatar May 01 '23 11:05 bofeiw

@mikehardy could you re-open this issue? Or maybe it's better to open a new one, as this is quite old?

marcoturi avatar May 07 '23 23:05 marcoturi

I've got the same problem, I do not have a solution to link multiple accounts with Google and an Email/Password sign in.

If I create an account with an email/password first and then sign in with Google, it will remove the email/password provider.

antoine-waag avatar May 11 '23 05:05 antoine-waag

same issue, it keeps replacing my account which is signed up using email/password

MrSharpp avatar Aug 21 '23 20:08 MrSharpp