使用OAuth 2.0进行Web服务器应用程序流程时无法选择正确的频道

问题描述:

我的应用遵循服务器端授权流程,如 https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps .我强行prompt=select_account.

My app follows the server side authorization flow as described in https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps. I force prompt=select_account.

在最基本的情况下,在第3步:Google提示用户同意"上,用户会看到一个屏幕,其中包含一个或多个名为选择帐户"的帐户.如果用户选择的帐户只有一个与之关联的通道,则流程直接进入步骤4:处理OAuth 2.0服务器响应".

In the most basic case, on "Step 3: Google prompts user for consent", the user sees a screen with one or more accounts titled "Choose an account". If the account that the user chooses only has a single channel associated with it, the flow then proceeds directly to "Step 4: Handle the OAuth 2.0 server response".

如果用户有许多与该帐户相关联的渠道,则该用户可能会看到另一个标题为选择您的帐户或品牌帐户"的屏幕.

If the user has many channels associated with the account then the user might see another screen titled "Choose your account or a brand account".

对于我个人而言,我有两个Google帐户:个人帐户和工作帐户,并且在选择帐户"屏幕上都可以看到它们.如果选择我的个人帐户,我将直接进入该应用程序.如果选择工作帐户,则会看到另一个屏幕,在该屏幕上可以选择我的个人"工作YouTube频道/帐户或公司范围内的共享频道/帐户.我总共可以管理和访问3个YouTube频道/帐户.

For me personally I have two Google accounts: personal and work account and I see them both on the "Choose an account" screen. If I choose my personal account, I get directly to the app. If I choose my work account I see the additional screen where I can choose my "personal" work YouTube channel/account or the company wide shared channel/account. In total I can manage and access 3 YouTube channels/accounts.

问题在于某些用户看不到选择您的帐户或品牌帐户"中列出的所有渠道.如果用户同时登录YouTube,他们仍然可以从YouTube右上角的帐户选择器访问其所有频道,但根本无法在选择器中看到它们.在这种情况下,我曾尝试调用YT API channels.list,但它不会返回缺少的频道,只会返回用户从选择器中选择的频道.

The problem is that some users don't see all of their channels listed in the "Choose your account or a brand account". If the users are logged in to YouTube at the same time, they can still access all of their channels from the top right corner account selector on YouTube, but they can't see them at all in the selector. I've tried calling YT API channels.list in these kinds of cases but it doesn't return the missing channels, only the one the user picked from the selector.

感觉好像我在这里遗漏了一些明显的东西,但是由于我对OAuth流没有太多控制权,因此我不确定如何解决此问题.这到底是我的问题,还是我只需要指示用户在他们的方面做些事情?

It feels like I'm missing something obvious here, but since I don't have much control over the OAuth flow, I'm not sure how to go about fixing this. Is this even a problem on my end or do I just need to instruct the users to do something on their end?

可能相关的事情:

  • YouTube APIs - Access mutiple youtube channels (Brand Accounts) using Google Admin account
  • YouTube API v3 get all channels associated with a logged in user
  • Youtube Brand Manager API V3 Support
  • Content owner "umbrella" accounts https://support.google.com/youtube/answer/6301188
  • default channel https://support.google.com/youtube/answer/6019090?hl=en
  • https://youtube-eng.googleblog.com/2013/06/google-page-identities-and-youtube-api_24.html
  • "Default channel with main account authorization" https://issuetracker.google.com/issues/35177410

未列出的帐户可能是用户不是所有者的帐户,而只是其经理的帐户,并且标记 onBehalfOfContentOwner 所在的帐户没有设置.

It could be that the unlisted accounts are accounts that the users are not owners of but just managers for and where the flag onBehalfOfContentOwner is not set.

channels.list API中,有参数

managedByMe 布尔

此参数只能在正确的位置使用 授权的请求.注意:此参数专用于 YouTube内容合作伙伴.

This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners.

将此参数的值设置为true,以指示API仅返回 onBehalfOfContentOwner 由内容所有者管理的频道 参数指定. 用户必须通过CMS帐户身份验证 链接到指定的内容所有者,并且onBehalfOfContentOwner必须 被提供.

Set this parameter's value to true to instruct the API to only return channels managed by the content owner that the onBehalfOfContentOwner parameter specifies. The user must be authenticated as a CMS account linked to the specified content owner and onBehalfOfContentOwner must be provided.

onBehalfOfContentOwner 字符串

此参数只能在经过适当授权的请求中使用. 注意:此参数专用于YouTube内容 合作伙伴.

This parameter can only be used in a properly authorized request. Note: This parameter is intended exclusively for YouTube content partners.

onBehalfOfContentOwner参数指示请求的 授权凭据可识别正在执行操作的 YouTube CMS用户 代表参数值中指定的内容所有者.这 参数适用于拥有和管理的YouTube内容合作伙伴 许多不同的YouTube频道它允许内容所有者 进行一次身份验证,即可访问其所有视频和频道数据, 无需为每个用户提供身份验证凭据 个别频道.用户进行身份验证的CMS帐户 必须链接到指定的YouTube内容所有者.

The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.