2012-09-05 96 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