Google Identity Toolkit - 登录后Google登录错误400

时间:2015-06-20 19:20:22

标签: html login google-signin

我目前正在开发一个管理系统来编辑网站内容,并且需要一个允许我检查用户是否在某个Google群组内的登录系统,因此我使用的是Google登录平台(作为但是,当我点击“登录”并选择帐户时,小部件只会显示“错误400:我们所知道的全部内容”。

我已经多次按照Google Sign In网站上的文档重写了登录系统。我的代码如下:
头:

<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="User-ID.apps.googleusercontent.com">

身体:

<div class="g-signin2" data-onsucess="onSignIn"></div>
<script>
function onSignIn(googleUser) {
  var profile = googleUser.getBasicProfile();
  console.log('ID: ' + profile.getId()); 
  console.log('Name: ' + profile.getName());
  console.log('Image URL: ' + profile.getImageUrl());
  console.log('Email: ' + profile.getEmail());
}
</script>

我的Google Developers项目设置为接受来自localhost和127.0.0.1的Javascript来源(即使它们是相同的),并且没有重定向URI,因为它们不是必需的。

我查看过谷歌状态网站,一切似乎都很好,以及向我的信息通信技术老师寻求帮助,所以我完全陷入困境,任何帮助都将不胜感激!

提前致谢:)

2 个答案:

答案 0 :(得分:4)

更新:从我的浏览器中的127.0.0.1切换到localhost似乎已经解决了问题,很奇怪,但只要它有效!

答案 1 :(得分:2)

在Google开发人员凭据中使用http://127.0.0.1仅适用于JavaScript来源。