Can't get Google App Engine OAuth2-sample (for Python) to work - 400 Error: redirect_uri_mismatch [duplicate]

北战南征 提交于 2019-12-11 03:38:19

问题


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-library/python/guide/aaa_oauth

https://code.google.com/p/google-api-python-client/downloads/list

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.

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.

Request Details

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?


回答1:


Go to the API Console: https://code.google.com/apis/console/

In your project, check the API Access settings and make sure that URL is one of the Redirect URIs. If not, add it.



来源:https://stackoverflow.com/questions/26612675/cant-get-google-app-engine-oauth2-sample-for-python-to-work-400-error-redi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!