【发布时间】:2014-12-24 02:44:10
【问题描述】:
我需要使用 OAuth2,因此我希望通过 App Engine 和 Python 进行开发,因为 Google 提供了示例代码,应该可以简化流程:
https://developers.google.com/api-client-library/python/guide/aaa_oauth
https://code.google.com/p/google-api-python-client/downloads/list
应该很简单;只需下载文件,在 app.yaml 中设置应用程序名称,在 client_secrets.json 中设置 id/secret。然后通过 Google App Engine Launcher 运行/上传。
但是,我得到 错误 400: 错误:redirect_uri_mismatch。 请求中的重定向 URI:{localhost 或 appspot.com}/oauth2callback 与注册的重定向 URI 不匹配。
请求详情
scope=https://www.googleapis.com/auth/plus.me
response_type=code
access_type=offline
redirect_uri={local/appspot}/oauth2callback
state={local/appspot}/:gP-pigwbwB3IBwMjafPlPToxNDE0NTA4ODYy
client_id={id-stuff}.apps.googleusercontent.com
我怀疑问题出在代码上(因为它是一个工作示例),但它还能是什么,我错过了什么?
【问题讨论】:
标签: python google-app-engine oauth-2.0 google-api sample