使用javascript和oauth2插入融合表 [英] Insert Into fusion table using javascript and oauth2

查看:99
本文介绍了使用javascript和oauth2插入融合表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请检查 http://www.udayan2k12.com/trial.html

我刚刚从Google链接(源)复制了源.
原始页面链接
我已经更改了客户端ID和api键
仍然无法正常工作

I have just copied the source from Google link (Source)
Original Page link
I have changed the client id and api key
Still this is not working

我的Cliend ID详细信息是![在此处输入图片描述] [1]

My Cliend ID details are ![enter image description here][1]

客户端ID:365219651081-istfrdgsvrtj324sufau0ldi5e8b3fmk.apps.googleusercontent.com
电子邮件地址:365219651081-istfrdgsvrtj324sufau0ldi5e8b3fmk@developer.gserviceaccount.com
客户机密:-
重定向URI:无
JavaScript起源:https://www [dot] udayan2k12 [dot] com
API密钥:AIzaSyA0FVy-lEr_MPGk1p_lHSrxGZDcxy6wH4o

Client ID: 365219651081-istfrdgsvrtj324sufau0ldi5e8b3fmk.apps.googleusercontent.com
Email address: 365219651081-istfrdgsvrtj324sufau0ldi5e8b3fmk@developer.gserviceaccount.com
Client secret: --
Redirect URIs: none
JavaScript origins: https://www[dot]udayan2k12[dot]com
API key: AIzaSyA0FVy-lEr_MPGk1p_lHSrxGZDcxy6wH4o

我应该做些什么改变才能使其正常工作. 授权"按钮不起作用.

What Changes shall i do to make it work. The Authorize button doesn't work.

但是它可以在http://udayan2k12 [dot] com/token.html

But it works in http://udayan2k12[dot]com/token.html

推荐答案

如果您检查错误控制台,则会看到以下错误:

If you check the error console you'll see that you get the following error:

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

并且当您遵循

And when you follow the link, the error message you get is: origin_mismatch

这意味着您没有添加 http://udayan2k12.com (不是 https )添加到您的客户端ID允许的JavaScript来源.您可以在 Google API控制台上进行更改(标签"API访问").您也可以添加localhost,以便它也可以在您的计算机上使用.

This means you did not add http://udayan2k12.com (and not https) to the allowed JavaScript origins for your client id. You can change that on the Google API Console (Tab "API Access"). You could add localhost as well so it works on you machine, too.

以下是我的设置示例:

请参阅来自Google的OAuth 2.0指南,以获取所需的所有步骤.

Please check the OAuth 2.0 guide from Google for all the steps you need.

这篇关于使用javascript和oauth2插入融合表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆