I have an application that use Google Login for get the information of the YouTube channel (upload videos, subscriptions, etc...). When the user tries to login, they can select from a list of Google accounts and after from a list of Youtube channels if the user have more than one. But, when a YouTube channel is selected, the API fails.
var login = function(options) {
if (!gapi.auth2){
// Retrieve the singleton for the GoogleAuth library and set up the client.
gapi.load('auth2', function(){
gapi.auth2.init({
client_id: config.credentials.googleApiClientId,
cookiepolicy: 'single_host_origin',
scope: 'https://www.googleapis.com/auth/youtube.readonly'
});
});
}
var GoogleAuth = gapi.auth2.getAuthInstance();
return GoogleAuth.signIn(options);
};
And in the callback JavaScript Google API says:
Object {type: "tokenFailed", idpId: "google", error: "USER_LOGGED_OUT"}