谷歌有一个OAuth2用户端here谷歌的OAuth2命令行示例
我completelly新到OAuth2,我想获得这个例子中工作前,我移动到OAuth2与我的应用程序集成的一个例子。我所做的是以下几点:
- 注册一个测试应用
- 获取客户端ID和客户端密钥
- 配置这些值转换成的client_secrets.json
- 运行测试程序:
python moderator.py
该应用程序打开浏览器,我可以(作为用户)授权应用程序访问我的帐户。但是,谷歌抱怨像这样(400错误请求):
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
我猜本地主机:8080是由moderator.py启动的内部Web服务器来。我的问题是:有人得到这个例子工作?我需要什么其他组件(Apache配置,DNS,...)
我很困惑与OAuth2和任何帮助将不胜感激。
我已经注册在谷歌API控制台我的测试应用程序,但我运行命令行应用程序(它被称为“命令行示例”)。我没有可以重定向到的URI。我需要在哪里或如何运行此示例,以便用户能够授权我的应用程序访问用户数据。这只是了解OAuth2如何工作的一个简单示例,但我无法使其运行。 – dangonfast 2012-07-12 19:52:56