Reputation: 1866
I have an app where you can either sign in via Apple Sign In, or Google Sign In. Assuming I have had an Android where I have signed in with Google. Then I change to iPhone and want to use Apple Sign In.
Currently if I sign in with Apple, I will get a different uid from FirebaseUser
compared to what I get when I sign in with Google.
Is there a way I can detect that there already is a user on Firebase and get that uid instead?
I am using Flutter and have read about linking, but that was not exactly what I wanted.
Upvotes: 2
Views: 751
Reputation: 600141
The typical flow to allow the user to sign in with multiple providers is:
fetchSignInMethodsForEmail
to check what provider(s) are associated with that email address.As Dharmaraj said, you can in step 4 allow linking the new provider with an existing account, but you may have to ask the user for more information than just their email address to be able to make that mapping.
Upvotes: 2
Reputation: 50930
You can link multiple auth providers to single account but that would still require user to login with their existing user credentials first. The domain of Google Account (e.g. @gmail.com
) and Apple ID (e.g. @icloud.com
) might be different so it's unlikely for Firebase to treat them as single account like it does for email-password and Google Accounts.
Upvotes: 3