2017-03-31 75 views
0

我收到了一個奇怪的問題。谷歌唱歌按鈕在我的本地系統上正常工作(使用url:localhost),但它在服務器上不起作用。 它不斷給我的錯誤400錯誤:INVALID_REQUEST see error page hereGoogle登錄按鈕無法在服務器上工作

我已經加入我的服務器的URL谷歌控制檯上,甚至從here

驗證了我的URL

我使用的示例代碼見我的演示here

回答

0

For use with requests from a web server. This is the path in your application that users are redirected to after they have authenticated with Google. The path will be appended with the authorization code for access. Must have a protocol. Cannot contain URL fragments or relative paths. Cannot be a public IP address.

您的重定向URI應該看起來更像這樣。

http://ec2-54-175-82-188.compute-1.amazonaws.com/user/auth 

當你的代碼運行時,它已經建立了以下要求(將這個在任何Web瀏覽器。)

https://accounts.google.com/o/oauth2/auth?redirect_uri=storagerelay%3A%2F%2Fhttp%2Fec2-54-175-82-188.compute-1.amazonaws.com%3Fid%3Dauth315255&response_type=permission%20id_token&scope=email%20profile%20openid&openid.realm=&client_id=651551554260-60j7jq0i2gjsfm1mm0rh74ie4m80md5i.apps.googleusercontent.com&ss_domain=http%3A%2F%2Fec2-54-175-82-188.compute-1.amazonaws.com&fetch_basic_profile=true&gsiwebsdk=2

如果你看重定向URI。

storagerelay%3A%2F%2Fhttp%2Fec2-54-175-82-188.compute-1.amazonaws.com%3Fid%3Dauth315255 

它不正確。它應該是您網站上用於處理認證的頁面。

+0

我已經添加了這個路徑是Google控制檯,但它仍然沒有工作 –

+0

看到我的控制檯設置:https://i.stack.imgur.com/zmGq4.png 和域驗證:https://i.stack .imgur.com/7TqwZ.png –

+0

是的,但看看錯誤消息。您沒有從那裏發送請求。重定向URI必須完全匹配您發送它的位置。 – DaImTo

相關問題