问题
Is it possible to get all the channels associated with a logged in user account, using youtube's version 3 API (https://developers.google.com/apis-explorer/#p/youtube/v3/).
The nearest call that I can see for YouTube.channels.list
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list
I attempt to use this by 'Authorizing the requests using OAuth 2.0' I select part=snippet and mine=true
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list?part=snippet&mine=true&_h=1&
but this only brings back the single channel not any of the other channels associated with the account, but the account I'm using has several channels. I need to get all channels for logged in user so I can give them the choice of what channel they are using, especially now google have messed YouTube around with the Google plus integration.
Does anybody know if this is possible?
回答1:
Found the answer in YouTube's API Blog here:
http://apiblog.youtube.com/2013/06/google-page-identities-and-youtube-api.html According to this as I'm using Android with OAuth2 there is no native Android account switcher, and
the then the API will choose the “wrong” channel in some cases, or even no channel (e.g., if the personal account doesn’t have a channel).
So I've got two options When this happens, the user has two options to specify the correct channel:
Use the Advanced Account Settings tool to select which channel should be used. This is recommended when a user has one channel they want to use for all applications.
Set up login credentials for each of their Google+ pages, and specify those > credentials, not their normal Google Account credentials, for each application that needs access.
Both these options require the user to do something outside the boundary of the Android Application, so both solutions are not usable. Unfortunatly this piece of functionality will have to wait until Android has some better way of switching the channel for the user...
回答2:
OAuth2 allows login in with only one channel, so that's not possible.
OAuth2 already gives user a choice to pick the channel they want to authorize and give access, so you don't have to implement it anyways.
来源:https://stackoverflow.com/questions/20072799/youtube-api-v3-get-all-channels-associated-with-a-logged-in-user