dan*_*ast 7 python google-api oauth-2.0 google-api-python-client
谷歌在这里有一个OAuth2客户端的例子
我完全是OAuth2的新手,我希望在我将OAuth2与我的应用程序集成之前让这个示例正常工作.我所做的是以下内容:
python moderator.py该应用程序打开一个浏览器,我可以(作为用户)授权应用程序访问我的帐户.但谷歌这样抱怨(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
Run Code Online (Sandbox Code Playgroud)
我想localhost:8080来自一个由moderator.py启动的内部Web服务器.我的问题是:有人得到这个例子吗?我需要哪些其他组件(apache配置,DNS,...)
我对OAuth2非常困惑,任何帮助将不胜感激.
在 OAuth 2.0 中,redirect_uri 参数通常是向提供者注册的。提供商还应该强制执行仅限 https 的 redirect_uri。
您需要在此处向Google注册redirect_uri: https: //code.google.com/apis/console/ ?pli=1#access