2012-09-05 31 views
0

請檢查http://www.udayan2k12.com/trial.html插入到其中使用融合表JavaScript和的oauth2

我剛纔複製從谷歌的鏈接(來源)
原始網頁link
我已經改變了客戶端ID和API密鑰
不過這源不工作

我Cliend ID細節[在這裏輸入的形象描述] [1]

客戶端ID:365219651081,istfrdgsvrtj324sufau 0ldi5e8b3fmk.apps.googleusercontent.com
郵箱地址:[email protected]account.com
客戶祕密: -
重定向的URI:無
JavaScript來源:https://開頭WWW [點] udayan2k12 [點] com
API key:AIzaSyA0FVy-lEr_MPGk1p_lHSrxGZDcxy6wH4o

我應該做什麼修改才能使其發揮作用。 授權按鈕不起作用。

但它工作在HTTP:// udayan2k12 [點] com/token.html

回答

2

如果您檢查錯誤控制檯,你會看到你收到以下錯誤:

Failed to load resource: the server responded with a status of 400 (Bad Request) https://accounts.google.com/o/oauth2/auth?client_id=365219651081-istfrdgsvrtj324sufau0ldi5e8b3fmk.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffusiontables&immediate=true&redirect_uri=postmessage&origin=http%3A%2F%2Fwww.udayan2k12.com&proxy=oauth2relay665167919&response_type=token&state=225646027&authuser=0 

而且當你按照link,你得到的錯誤信息是:origin_mismatch

這意味着你沒有添加http://udayan2k12.com(而不是HTTPS)添加到您的客戶端ID的允許JavaScript起源。您可以更改Google API Console(標籤「API訪問」)。你也可以添加本地主機,所以它也適用於你的機器。

這裏是我的設置爲例:

My client id settings

請檢查OAuth 2.0 guide from Google爲你需要的所有步驟。

+0

感謝您的救星:-)我使用的是https而不是http:0 – user1637982