18

Here am trying to implement Google, Facebook and Twitter login using firebase.

I have faced many scenario which was not clear for me.

Each individual login is working correctly, I didn`t found any problem here.

My requirement is when the user log-in with xxxxx@gmail.com for the first time with some provider(Google,Facebook,twitter) and after success, user logged out. On second log-in the user use same id xxxxx@gmail.com with some other provide rather than one used before,that time We should not allow the login process. User need to log-in with the same provider from next time.

Below are the cases I found ,

  1. For first time when in log-in using xxxxx@gmail.com using google, after success popup i logged out. For second time i try to log-in using same id xxxxx@gmail.com using Facebook or twitter its throws an error "An account already exists with the same email address but different sign-in credentials".

  2. For first time when in log-in using xxxxx@gmail.com using twitter or Facebook, after success popup I logged out. For second time I try to log-in using same id xxxxx@gmail.com using google. It does not showing any Exception. Here I need to notify the user "xxxxx@gmail.com is associated with twitter or Facebook, Use same provider to login "

I don`t know whats happening in second case.

For this id xxxxx@gmail I have google, Facebook and twitter account.

KENdi
  • 7,576
  • 2
  • 16
  • 31
Priya
  • 672
  • 1
  • 5
  • 21
  • Did you ever work out how to do this? i.e. to keep the default account merging behaviour where it will link the same email from Google, Apple or Email into a single account and also make it work for Facebook? I cannot seem to see how to do this other than to ask the user to "Try again with another provider that they have already used for this email" which is pretty poor Ux! – Kram Aug 09 '23 at 09:17

2 Answers2

20

See if it helps you. Change this settings in Firebase console

enter image description here

enter image description here

Lijith Vipin
  • 1,870
  • 21
  • 29
  • 1
    Oh, please. He has clearly enabled that option, that is why he gets errors for facebook and twitter. I also have the same issue in my web app, where I'm implementing email, google, and github – aravk33 May 30 '18 at 05:54
  • 1
    if I active that I can log in properly but I create a new user with a new id. If I need my previous user to see (for example) my post won't work – Dani May 31 '18 at 16:45
  • 33
    I totally disagree with the answer provided. If in my app, I expects that if user login with same email address using multiple providers like google, fb...it must create a single account without any issues. – Shreeram K Mar 18 '20 at 13:54
  • 7
    Agree with @ShreeramK, Firebase should be able to merge in the accounts. We should really avoid allowing multiple accounts per single email address! – Zorayr Aug 26 '20 at 00:09
  • This is not the right approach if you want to make use of Firebase's merging - i.e. I can sign in with the same email address using Google, Apple or Email and it will merge the users and provide the same UserId for each (just a different provider). However with Facebook, this is a massive pain as it doesn't do this and I don't want to have to start having different users to track for the aforementioned Apple, Google and Email users. I simply want to merge Facebook in the same way - there simply doesn't appear to be a good way to do this. – Kram Aug 09 '23 at 09:11
0

authentication->settings->user account linking

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 06 '22 at 12:34
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/32856830) – Dr Mido Oct 07 '22 at 16:57
  • 1
    @DrMido I recommend to make a difference between an external link (which your comment would be appropriate for) and a picture inserted in the accepted, even recommended way, which is not considered a link-only. This post lacks some prose explanation, but it is not link-only. – Yunnosch Oct 11 '22 at 07:48
  • Problem here is that it creates a new User (and new GA tracking etc.) for each provider with the same email (whereas it will merge Google, Apple and Email by default, which is exactly what I want as they are the same person) - I just want the same behaviour with Facebook and I cannot figure out how to do this. There is a Link accounts api but for that I need to have both credentials in my hand.... – Kram Aug 09 '23 at 09:15