firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.72k stars 3.97k forks source link

[Firebase_Auth]: MicrosoftCredentials not working in signInWithCredential #16598

Open alfie-trbc opened 3 days ago

alfie-trbc commented 3 days ago

Is there an existing issue for this?

Which plugins are affected?

Auth

Which platforms are affected?

Android, iOS

Description

Based on the Code Documentation which I initially checked, 3rd party login is feasible in microsoft and just get the accessToken and pass that to signInWithCredential:

This is the code documentation under [MicrosoftAuthProvider] class : image

BUT in firebase documentation it says that this is not supported: image

The error I'm encountering is: ([firebase_auth/channel-error] "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCredential".)

Is microsoft really not supported via signInWithCredential? if that so, why the documentation under MicrosoftAuthProvider contradict the official firebase documentation?

Reproducing the issue

1.) I used flutter_web_auth_2 package for 3rd party authorize

2.) I get the auth code to use for getting the accessToken and refreshToken from microsoft API

3.) After that I created a credential like this:

  final credential = MicrosoftAuthProvider.credential(accessToken);

4.) passed the credential in signInWithCredential

  final userCredential = await auth.signInWithCredential(credential);

5.) It will get an error under signInWithCredential:

([firebase_auth/channel-error] "dev.flutter.pigeon.firebase_auth_platform_interface.FirebaseAuthHostApi.signInWithCredential".)

Firebase Core version

3.5.0

Flutter Version

3.24.4

Relevant Log Output

No response

Flutter dependencies

Expand Flutter dependencies snippet
```yaml Replace this line with the contents of your `flutter pub deps -- --style=compact`. ```

Additional context and comments

No response

SelaseKay commented 2 days ago

Hi @alfie-trbc, thanks for the report. signInWithCredential is indeed not supported for Microsoft as stated here. The documentation has to be updated accordingly.