2015-06-14 52 views
0

我正在尝试在我的网站上放置Google +登录按钮,但当我尝试登录时出现400错误。这是我得到的。我的网页上登录Google登录按钮时出现错误400

400. That’s an error. 

The requested URL was not found on this server. That’s all we know.the 

我有以下列入<head>

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

和下面的地方我想按钮:

<div class="g-signin2" data-onsuccess="onSignIn"></div> 

回答

0

此代码应为你工作:

<html> 
<head> 
    <title>Test Google Login</title> 
    <script src="https://apis.google.com/js/platform.js" async defer></script> 
    <meta name="google-signin-client_id" content="620096179377-ula3qjt2s01qqhberlqq470n16kccnh5.apps.googleusercontent.com"> 
    <script> 
    function onSignIn(googleUser) { 
    console.log(googleUser); 
    } 
    </script> 
</head> 
<body> 
    <div class="g-signin2" 
    data-onsuccess="onSignIn"></div> 
</body> 
</html> 

如果问题依然存在,您能否附上导致400请求的详细信息? (网址应该足够了)

+0

我测试了你的代码。即时通讯仍然得到同样的错误。网址为https://accounts.google.com/o/oauth2/auth?redirect_uri=storagerelay%3A%2F%2Fhttp%2F127.0.0.1%3A51792%3Fid%3Dauth48337&response_type=permission&scope=email%20profile%20openid&openid。 realm =&client_id = 620096179377-ula3qjt2s01qqhberlqq470n16kccnh5.apps.googleusercontent.com&ss_domain = http%3A%2F%2F127.0.0.1%3A51792&fetch_basic_profile = true –

+0

错误是:“不是有效的域名:'127.0.0.1'”。你可以切换到http:// localhost? –