3

I knew it is raised already, but i want to clear and sum it up.

I use FireBase authentication to allow the following Sign Up:

  • Facebook
  • Google
  • Email

When signed up with Email, but later decide you want to change credential to Facebook (Having the same email) You receive an error. Same issue from Google to Facebook.

The Error:

An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.

However, if you Logged with Facebook or Email you CAN change your credential to Google.

Theoretically you can allow multiple accounts with the same email: enter image description here

However, it means (from what i understood) Firebase auth will generate a unique UserID for each additional credential which means that if you use UserID to track data of user (messages, score, etc..) you need somehow track all UserIDs from all credentials. This can ruin one of Firebase authentication purposes.

If you decide to go this way, you will need to link the accounts using LinkWithCredentialAsync. As i understood this can be ONLY be done if you are LOGGED IN with your other credential.

I rising this because i was disappointed to discover this only after implementing Firebase.

The solution from this thread Stackoverflow thread is creative (see pupadupa scheme), but i do not want to go this way.

If someone can add on to this and found some sort of solution, please post it.

Dror
  • 1,262
  • 3
  • 21
  • 34
  • The issue is how else can you ensure that the user logging in with the subsequent login e.g. Facebook or Google actually was the user that created the email account. Hence the need to login to the original account first and then link. To me thats expected behaviour and one that ive implemented without issue. – Jack Woodward Nov 28 '18 at 09:57
  • Note that from Facebook sign in you can change to Google but not vice versa, From what i remember Facebook also has Email verification. aka, if you SignUp Facebook you receive an email verification to active account. – Dror Nov 28 '18 at 10:04
  • If you are facing issues with linkings I would log a bug with firebase support ive not faced an issue with linking different auth methods. Facebook does not enforce email verification and still you cant be sure that the user of the facebook account is not a hacker so making you login to the original account is a safety mechanism and then linking. – Jack Woodward Nov 28 '18 at 10:06
  • I do not use linking because of the reasons i mentioned in the main thread (different UserIds). What is your solution? You popup a message that credential already exist and that you must login with the existing credential? – Dror Nov 28 '18 at 10:14
  • They dont get different Users IDs. Its all one account when you link them, you may have something wrong in your implementation if thats the case. As long as the user is logged in and you link the new one thats not an issue. And yeh thats what I do. I inform them they have an account. – Jack Woodward Nov 28 '18 at 10:17
  • You shouldnt be ticking that box to allow multiple accounts with the same email otherwise it would create separate accounts entirely with different auth methods – Jack Woodward Nov 28 '18 at 10:18
  • You are LINKING accounts without ticking "allow multiple accounts"? – Dror Nov 28 '18 at 10:19
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/184388/discussion-between-jack-woodward-and-dror). – Jack Woodward Nov 28 '18 at 10:21

0 Answers0