What redirect uri should I use on a local system?

随声附和 提交于 2020-01-26 02:07:19

问题


I am using Google Oauth API to get calendar information to my raspberry pi. The raspberry has a local webserver running, only accessible from my local network. What redirect uri should I use to get the authorization response to work?

If I run the Python script on my computer I could obviously use localhost. That did not work if connecting to my Raspberry (via http) and try to get access, then I get redirected to localhost (obviously) instead of 192.168.1.20 or whatever IP my raspberry currently has.

How could I solve this?


回答1:


You have two options

  • You can use http:/192.168.1.20/... as the redirect URI . That's assuming that your Raspberry PI's address does not change.

  • Another option is to create a credential for an installed application in the Cloud Console. With this you can use the redirect URI urn:ietf:wg:oauth:2.0:oob. Instead of redirecting you, this URI will make Google display a code that you must manually provide to your Raspberry Pi application. Typically you would provide a text in your web interface where the user can copy/paste the code. You can find more info about installed applications and OAuth here.



来源:https://stackoverflow.com/questions/28056545/what-redirect-uri-should-i-use-on-a-local-system

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