Google has an example of an OAuth2 client here
I am completelly new to OAuth2 and I would like to get this example working before I move to integrate OAuth2 with my application. What I have done is the following:
python moderator.py
The application opens up a browser, where I can (as a user) authorize the application to access my account. But Google is complaining like this (400 Bad Request):
Error: redirect_uri_mismatch
The redirect URI in the request: http://localhost:8080/ did not match a registered redirect URI
Learn more
Request Details
from_login=1
scope=https://www.googleapis.com/auth/moderator
response_type=code
access_type=offline
redirect_uri=http://localhost:8080/
approval_prompt=auto
as=-xxxxxxxxxxxxx
pli=1
client_id=xxxxxxxxxxx.apps.googleusercontent.com
authuser=0
hl=en
I guess the localhost:8080 is coming from an internal web server started by moderator.py. My question is: has somebody goten this example to work? What other components do I need (apache configuration, DNS, ...)
I am very confused with OAuth2 and any help would be greatly appreciated.
OAuth 2.0 allows users to share specific data with an application while keeping their usernames, passwords, and other information private. For example, an application can use OAuth 2.0 to obtain permission from users to store files in their Google Drives. This OAuth 2.0 flow is called the implicit grant flow.
First of all, sorry if my answer isn't very precise, because I'm also very new to OAuth (and even python)... and also sorry if it came too late, I don't usually access here.
Have you tried using this (worked for me): REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
Check this: https://developers.google.com/accounts/docs/OAuth2InstalledApp#choosingredirecturi
Here I have a piece of code with a complete OAuth flow working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With