I've been trying to setup an application that supports 3 types of Authentication: - Email / password - Google (OAuth) - Facebook (OAuth)
In Firebase > Authentication > Sign-in methods, I've enabled the 3 options mentioned above. In Firebase > Authentication > Advanced, I have the following set: "Prevent creation of multiple accounts with the same email address"
Just FYI, the password I use in my app to create an account with [Email/password] is different from my Google account, which is also different from my Facebook account (3 separate passwords - very real world scenario)
- [Email/password]: [email protected], Password123
- [Google]: [email protected], Password456
- [Facebook]: [email protected], Password789
I want a user to Sign up with whatever provider they want to and then later on, link any other available sign-in / authentication options.
I can manage to properly setup [Email / Password] or the OAuth providers (Google and Facebook). But, when I try and integrate all 3 together, all hell breaks loose. Some noted errors:
Scenario A)
- Create user with email / password / sign in / sign out (works fine)
- Login with Google OAuth (associated to same email) as above, accounts are linked together / sign in / sign out
- attempt to login with email/ password again -> ERROR
- Google OAuth seems to have overridden the previous account settings
Scenario B)
- Create user with email / password / sign in / sign out (works fine)
- Login with Facebook OAuth (associated to same email) as above, accounts are linked together but get an error when attempting to login because my password used doesn't match my Facebook password. Yet this DOESN'T HAPPEN when I link my Google and Facebook accounts together. Why this issue with [Email/password] and OAuth providers?
I know there have been some updates / changes recently within Firebase, maybe the documentation / examples I checked weren't up-to-date. Has anyone successfully been able to [Email/password] authentication with OAuth providers as well? Can anyone provide a good example online or some recent documentation I can take a look at?
Btw, running code in Angular5 if that helps. Thanks in advance for any help.
JB