Correct redirect URI for Google API and oauth 2.0

若如初见. 提交于 2019-12-29 05:41:06

问题


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.

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

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?

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

currently, my javascript origin is: https://localhost

redirect URI: https://localhost/oauthWindow.html

Thanks


回答1:


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

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.

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.



来源:https://stackoverflow.com/questions/11330919/correct-redirect-uri-for-google-api-and-oauth-2-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!