Javascript 谷歌登录youtube账户失败

Javascript 谷歌登录youtube账户失败,javascript,oauth-2.0,google-api,youtube-api,google-authentication,Javascript,Oauth 2.0,Google Api,Youtube Api,Google Authentication,我有一个应用程序,使用谷歌登录获取YouTube频道的信息(上传视频、订阅等)。当用户尝试登录时,他们可以从Google帐户列表中进行选择,如果用户有多个Youtube频道,则可以从Youtube频道列表中进行选择。但是,当选择YouTube频道时,API将失败 在回调JavaScript中,Google API说: 对象{type:“tokenFailed”,idpId:“google”,错误:“USER\u LOGGED\u OUT”} 遇到了一个类似的问题,经过一段时间的实验,我不完全确

我有一个应用程序,使用谷歌登录获取YouTube频道的信息(上传视频、订阅等)。当用户尝试登录时,他们可以从Google帐户列表中进行选择,如果用户有多个Youtube频道,则可以从Youtube频道列表中进行选择。但是,当选择YouTube频道时,API将失败

在回调JavaScript中,Google API说:

对象{type:“tokenFailed”,idpId:“google”,错误:“USER\u LOGGED\u OUT”}


遇到了一个类似的问题,经过一段时间的实验,我不完全确定是什么问题。我更改的内容是向
登录
看涨期权添加
提示:“选择账户”
,并向
初始
看涨期权添加
获取基本配置文件:false

下面是一个例子,请确保将您自己的client_id添加到init调用中,并确保将output.jsbin.com域列入白名单,并从该域预览jsbin

var auth2 = gapi.auth2.init({
  client_id: '',
  scope: 'https://www.googleapis.com/auth/youtube',
  fetch_basic_profile: false,
  cookie_policy: 'single_host_origin'
});


auth2.signIn({
  scope: 'https://www.googleapis.com/auth/youtube',
  prompt: 'select_account'
}).then(function(result) {
  console.log('Signed in!');
  console.log(result);
}, function(error) {
  console.log(error);
});

你能出示你的密码吗?幸运吗?
var auth2 = gapi.auth2.init({
  client_id: '',
  scope: 'https://www.googleapis.com/auth/youtube',
  fetch_basic_profile: false,
  cookie_policy: 'single_host_origin'
});


auth2.signIn({
  scope: 'https://www.googleapis.com/auth/youtube',
  prompt: 'select_account'
}).then(function(result) {
  console.log('Signed in!');
  console.log(result);
}, function(error) {
  console.log(error);
});