无法使Google App Engine OAuth2-示例(适用于Python)正常工作-400错误:redirect_uri_mismatch [英] Can't get Google App Engine OAuth2-sample (for Python) to work - 400 Error: redirect_uri_mismatch
问题描述
我需要使用OAuth2,所以我希望通过App Engine和Python进行开发,因为Google提供了使该过程变得容易的示例代码:
I need to use OAuth2 so I wish to develop through App Engine and Python since Google offers sample-code that should make the process easy:
https://developers.google.com/api-client-库/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启动器运行/上传.
It should be simple; just download the files, set the application name in app.yaml and the id/secret in the client_secrets.json. Then run/upload through Google App Engine Launcher.
但是,我收到错误400: 错误:redirect_uri_mismatch. 请求中的重定向URI: {localhost或appspot.com} /oauth2callback与注册的重定向URI不匹配.
However, I get the Error 400: Error: redirect_uri_mismatch. The redirect URI in the request: {localhost or appspot.com}/oauth2callback did not match a registered redirect 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
我怀疑问题出在代码中(因为这是一个有效的示例),但是还可能是什么,我还缺少什么?
I doubt that the problem lies in the code (since it's a working sample), but what more can it be, what am I missing?
推荐答案
转到API控制台: https ://code.google.com/apis/console/
在您的项目中,检查API访问设置,并确保URL是重定向URI之一.如果没有,请添加它.
In your project, check the API Access settings and make sure that URL is one of the Redirect URIs. If not, add it.
这篇关于无法使Google App Engine OAuth2-示例(适用于Python)正常工作-400错误:redirect_uri_mismatch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!