Question

I am trying to build an Android app that aggregates data from various online profiles. My first stop is gathering YouTube data but I've run into a snag that the YouTube API documentation isn't really clearing up for me. When a user has 2 or more YouTube accounts linked to one email address it seems to just choose one and return it to me instead of giving the option to the user. So there is no way to know whether that is the account the user actually wants to get data from. Is there anyway through OAuth or the API to specify which account to use?

For example I own 2 YouTube accounts tied to one email address. The first one I have was created around 2008 and the second just recently when YouTube implemented the Google+ integration. My first one has all of my videos, views, subscribers, etc. attached to it and the second has nothing. I want my app to get the data from the profile with all the info in it.

Is there any way to choose which to use?

Was it helpful?

Solution

Presuming that the two channels aren't associated with the same account directly (e.g. available in the https://developers.google.com/youtube/v3/docs/channels/list) - worth a check if you haven't.

If they aren't (which is what I suspect), then this is a bit tricky. The way multiple accounts are handled is via associating a Google+ page with the YouTube username (so a given Google account can have several pages/youtube usernames associated). I suspect your first one is associated page, and the second is attached to your main Google profile. This is in part to keep them separated - so no one has to know you're both unless you want them to.

On the web, the user will get a chooser for which account they want to use, but unfortunately this isn't supported on Android at the moment. The only way to log in as that user in Android is to create a password for the page associated with the YouTube channel you want to use, and adding that in the Android account manager: https://support.google.com/plus/answer/2882201?hl=en-GB

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top