flutterfire icon indicating copy to clipboard operation
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

Open vitor-soares-iteam opened this issue 1 year ago • 5 comments

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

Captura de Tela 2023-01-04 às 16 51 48

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. Captura de Tela 2023-01-04 às 16 54 21

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. Captura de Tela 2023-01-04 às 18 17 58

Apparently only when the account is based on microsoft provider the microsoft provider gets replaced.

vitor-soares-iteam avatar Jan 04 '23 20:01 vitor-soares-iteam