更正 Google API 和 OAuth 2.0 的重定向 URI [英] Correct redirect URI for Google API and OAuth 2.0

查看:27
本文介绍了更正 Google API 和 OAuth 2.0 的重定向 URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Google Maps API 制作应用程序.我希望能够让一个人在电脑上,观看另一个人在地图上编辑的内容.我正在考虑将地图信息传递给 Google Fusion Table.另一个人将能够将所有内容视为一层.我希望该程序仅从用户的浏览器运行,而不是为其构建网站.

I am making an application with the Google Maps API. I want to be able to have one person on a computer, watch what another person has edited to a map. I am thinking of passing information of the map to a Google Fusion Table. The other person will be able to see everything as a layer. I would like for the program to just run from the user's browser and not build a website for it.

要编辑融合表,我需要获得访问权限/令牌.我目前正在尝试使用这些 JavaScript 来完成此操作.ScriptSample.htmloauthWindow.html,和 gwt-oauth2.js.这是工作示例.

To edit the fusion tables, I need to gain access/tokens. I am currently trying to use these there JavaScript to accomplish this. ScriptSample.html, oauthWindow.html, and gwt-oauth2.js. This is the working example.

当我运行它们时,我收到一个错误消息,指出 redirect URI 不正确.它说我用来重定向的文件没有权限.我的第一个明显问题是:

When I run them, I get am error that says the redirect URI is incorrect. It says the file I use to redirect does not have authority. My first obvious question is:

如何授予该文件重定向的权限?

How do I give that file authority to redirect?

在我的 API 控制台中,我将其设置为客户端 Web 应用程序.我应该将其更改为已安装的应用程序吗?

In my API console, I have it set up as a client-side web application. Should I change it to an installed application?

目前我有以下设置:

  • 我的 JavaScript 来源是:https://localhost
  • 重定向 URI:https://localhost/oauthWindow.html

谢谢

推荐答案

在 Dev 工作中使用 localhost url 没有问题 - 显然它需要在生产时进行更改.

There's no problem with using a localhost url for Dev work - obviously it needs to be changed when it comes to production.

你需要去这里:https://developers.google.com/accounts/docs/OAuth2然后按照 API 控制台的链接 - 基本步骤部分中的链接.当您填写新的申请表时,系统会要求您提供重定向网址.输入您在获得访问权限后要访问的页面.

You need to go here: https://developers.google.com/accounts/docs/OAuth2 and then follow the link for the API Console - link's in the Basic Steps section. When you've filled out the new application form you'll be asked to provide a redirect Url. Put in the page you want to go to once access has been granted.

在形成 Google oAuth Url 时 - 您需要包含重定向 url - 它必须完全匹配,否则您会遇到问题.它还需要经过 UrlEncoded.

When forming the Google oAuth Url - you need to include the redirect url - it has to be an exact match or you'll have problems. It also needs to be UrlEncoded.

这篇关于更正 Google API 和 OAuth 2.0 的重定向 URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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