问题
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