【问题标题】:Can't get Google App Engine OAuth2-sample (for Python) to work - 400 Error: redirect_uri_mismatch [duplicate]无法让 Google App Engine OAuth2-sample(用于 Python)工作 - 400 错误:redirect_uri_mismatch [重复]
【发布时间】: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


    【解决方案1】:

    转到 API 控制台:https://code.google.com/apis/console/

    在您的项目中,检查 API 访问设置并确保 URL 是重定向 URI 之一。如果没有,请添加它。

    【讨论】:

    • 这给了我一个新的错误。更近一步,谢谢!
    猜你喜欢
    • 1970-01-01
    • 2021-09-06
    • 1970-01-01
    • 2021-06-22
    • 1970-01-01
    • 1970-01-01
    • 2022-11-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多