Flutter google_sign_in "Choose Account" does not list Youtube brand accounts?

Viewed 536

I am currently working with https://pub.dev/packages/google_sign_in.

It works so far, but in the Google Sign In Popup, I don't see my Youtube brand account there at "Choose Account" and as a result, Youtube Data API does not recognize API Calls correctly with the parameter "mine=true", because if I select my Google Account, it has no connection to the Youtube account.

In the docs of Youtube Data API, if I do "Try now" there, the Google SignIn lists my Youtube brand accounts after I select my Google Account.

Used Packages:

Flutter 2.0.1
Dart 2.12.0
google_sign_in: 5.0.0

Example Code (permissions with firebase and API Explorer are set and works):

final GoogleSignIn _googleSignIn = GoogleSignIn(
  signInOption: SignInOption.standard, // not necessary
  scopes: <String>['https://www.googleapis.com/auth/youtube']);
...
this._googleSignIn.onCurrentUserChanged.listen((GoogleSignInAccount account) {}
...
this._googleSignIn.signIn();
...

As a result, the Youtube Data API call, which returns an empty result for my Google Account (but the call is valid):

http.get(
    Uri.parse(
 'https://www.googleapis.com/youtube/v3/channels?part=id,snippet,contentDetails&mine=true'),
 headers: await currentGoogleUser.authHeaders);

Any help, so I get the screen to select Youtube brand account in the GoogleSignIn process?

See also at https://github.com/flutter/flutter/issues/77694

1 Answers

Try removing <String> from:

scopes: <String>['https://www.googleapis.com/auth/youtube']);

That's my guess.

Related