flutterfire
flutterfire copied to clipboard
🐛 [FirebaseAuth] Apple Sign in Method when user already have Microsoft account forcefully changes provider instead of throwing account-exists-with-different-credential
Bug report
We have Microsoft Sign in and Apple Sign in implemented within our app. I have an Apple ID with the same e-mail as my microsoft Azure AD e-mail. At first I had created an microsoft account
Then, I tried to log in using Apple sign in using the same e-mail registered with my microsoft account. with "await FirebaseAuth.instance.signInWithCredential(appleCredential);"
The expected outcome was an exception with the code: "account-exists-with-different-credential" Since I already had a microsoft account with that e-mail.
Instead, my account was simply changed into an apple provider account, resulting in some unexpected outcomes. Including not being able to access through the microsoft credential anymore.
The Microsoft sign in is made calling the method "signInWithProvider(MicrosoftAuthProvider())" and it works fine and gives the expected outcome: "throws exception with code account-exists-with-different-credential".
Since this bug needs apple authentication and microsoft authentication implemented, its quite hard to provide code to reproduce this behavior.
Let me know if I can help with anything else.
Edit:
When I tried doing the same with an E-mail provider account the result was that the two providers were automatically merged.
Apparently only when the account is based on microsoft provider the microsoft provider gets replaced.