flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[firebase_auth]: GoogleAuthProvider scopes don't seem to do anything

Open jellynoone opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

No response

Description

When using the GoogleAuthProvider and setting the profile scope to get the user's name does nothing. The 'displayName' is always null.

Reproducing the issue

Simply doing running the following agains the LIVE instance should show the described behaviour.

final provider = GoogleAuthProvider().addScope('email').addScope('profile');

FirebaseAuth.instance.signInWithProvider(provider);

In addition, I tried debugging this issue. When the GoogleAuthProvider is converted to a PigeonSignInProvider the scopes are lost. They are passed to native as null. The null is observed here: https://github.com/firebase/flutterfire/blob/b1584aa7f3f97bc263b1e8966fd33495613e20b7/packages/firebase_auth/firebase_auth_platform_interface/lib/src/method_channel/method_channel_firebase_auth.dart#L380-L398

The root of the issue seems to be with: https://github.com/firebase/flutterfire/blob/b1584aa7f3f97bc263b1e8966fd33495613e20b7/packages/firebase_auth/firebase_auth_platform_interface/lib/src/method_channel/utils/convert_auth_provider.dart#L9-L38

It doesn't convert a GoogleAuthProvider to an OAuthProvider.

Firebase Core version

3.1.1

Flutter Version

3.22.2

Relevant Log Output

No response

Flutter dependencies

No response

Additional context and comments

No response

jellynoone avatar Jun 28 '24 17:06 jellynoone