2

我正在关注 Google 开发人员“快速入门:在 Python 中运行 Gmail 应用程序” https://developers.google.com/gmail/api/quickstart/quickstart-python

在步骤 3“运行示例”之前一切正常,其中的说明是“使用 python quickstart.py 运行示例”。

当我这样做时,预期的结果是我的浏览器将加载并启动授权。相反,我在 Google 上得到了错误 400 页面。

Error: redirect_uri_mismatch

The redirect URI in the request: http://localhost:8080/ did not match a registered redirect URI

问题是,“localhost ...”不在重定向 URI 中,我检查了许多其他类似的问题,通常答案表明确认 URL 完全相同。我已经做到了,https/http,额外的反斜杠,都是一样的。谷歌仍然说我正在发送 localhost:8080。

4

1 回答 1

4

开发控制台中指定的重定向 URI 应与应用实际重定向到的内容相匹配。只需http://localhost:8080/在开发控制台中用作您的重定向 uri,而不是使用 oauthclient... 后缀(这是开发控制台为您提供的默认设置)。

于 2014-07-04T05:48:20.250 回答