2014-10-02 161 views
0

我在使用Google+身份驗證時遇到了一些問題,我似乎無法解決這個問題。Google+ OAuth API - 錯誤400

我在本地機器上的WAMP服務器上運行一個頁面。該網站被託管在localhost:80

我設置了OAuth認證,如下:

REDIRECT URIS 
http://localhost:80/oauth2callback 

JAVASCRIPT ORIGINS 
http://localhost:80 

所以回調和JS的起源都調整爲localhost:80(據我所知) 。

但是,當我使用Google+登錄按鈕時,我點擊了我的Google帳戶,但隨後出現以下錯誤消息。

400. That’s an error. 

Error: origin_mismatch 

Request Details 
= 
from_login=1 

e=3100077 

scope=https://www.googleapis.com/auth/plus.login 

redirect_uri=postmessage 

state=886354831|0.2093651692 

origin=http://localhost 

as=6ab1e337782cd5f6 

pli=1 

request_visible_actions=http://schema.org/AddAction 

hl=en 

response_type=code token id_token gsession 

cookie_policy=single_host_origin 

proxy=oauth2relay1316100299 

include_granted_scopes=true 

client_id=/blanked this part for security/-jsaproji1sk0u1b8kjlh3m3n4i232m4b.apps.googleusercontent.com 

authuser=0 
That’s all we know. 

其中概述錯誤是由於origin_mismatch。我試過設置OAuth原點&重定向憑證分別爲本地主機和本地主機:80,但都出現錯誤400

有人多一點經驗給我一隻手?我仍然很新的這

由於提前, 山姆

回答

1

你嘗試還設置了JavaScript的起源:http://localhost不僅僅是http://localhost:80

來源必須是確切匹配,並且在您的查詢中,它不包含端口號作爲原點的一部分。

您可以通過每行添加一個來添加多個來源。
- Dragonfire