Not being able to choose the right channel when using OAuth 2.0 for Web Server Applications flow
Asked Answered
I

2

12

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.

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".

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.

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.

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?

Possibly related things:

Interjoin answered 27/7, 2017 at 12:5 Comment(0)
A
1

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.

In the channels.list API there are the parameters

managedByMe boolean

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

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.

and

onBehalfOfContentOwner string

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

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.

Alitaalitha answered 12/8, 2017 at 9:59 Comment(2)
Thanks for the answer! This could be the case, I'm not entirely sure though as the accounts in question should only be managed by a single person. I'll get back to this once I've figured out if this is the problem.Guenzi
@LeoLännenmäki I know it's been a long time, but I'm running into the same issue. Any luck figuring out if this was the problem for you?Loralorain
L
0

If a user is a manager of a channel which is not linked to a brand account, they will not be able to Oauth as that channel.

Laboured answered 29/8, 2023 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.