【发布时间】:2021-06-07 05:05:47
【问题描述】:
我目前正在使用https://pub.dev/packages/google_sign_in。
到目前为止它工作正常,但在 Google 登录弹出窗口中,我在“选择帐户”处看不到我的 Youtube 品牌帐户,因此,Youtube 数据 API 无法正确识别带有参数“我的”的 API 调用=true",因为如果我选择我的 Google 帐户,它与 Youtube 帐户没有任何关联。
在 Youtube Data API 的文档中,如果我在那里“立即尝试”,Google SignIn 会在我选择我的 Google 帐户后列出我的 Youtube 品牌帐户。
使用过的包:
Flutter 2.0.1
Dart 2.12.0
google_sign_in: 5.0.0
示例代码(使用 firebase 和 API Explorer 的权限已设置并有效):
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();
...
因此,Youtube 数据 API 调用为我的 Google 帐户返回了一个空结果(但调用有效):
http.get(
Uri.parse(
'https://www.googleapis.com/youtube/v3/channels?part=id,snippet,contentDetails&mine=true'),
headers: await currentGoogleUser.authHeaders);
有什么帮助,所以我在 GoogleSignIn 过程中得到了选择 Youtube 品牌帐户的屏幕?
【问题讨论】:
-
不,正如您在最后一条评论中看到的那样,google 和 youtube 帐户之间没有关联,所以我猜他也无法选择他的 youtube 品牌帐户。
标签: api flutter google-api google-signin