python - Google Drive API Quickstart.py 错误 400 : redirect_uri_mismatch

标签 python google-drive-api google-authentication

我正在使用https://developers.google.com/drive/api/v3/quickstart/python访问 Google Drive Api,但 Google 不断抛出 redirect_uri_mismatch 错误。

我将错误中的 localhost:number 添加到 Web 应用程序的客户端 ID 中的授权重定向 URI,但每当我运行 quickstart.py 时,本地主机号都会发生变化。

我看到 StackOverflow 上有很多关于此事的问题,我已经花了几个小时寻找解决我的问题,但我还没有找到似乎可以解决我的问题的答案。

有什么想法吗?


尝试过其他人的答案


目前

enter image description here

最佳答案

Tanaike的评论和答案在这里有效:Google APIs OAuth 2.0 redirect_uri_mismatch error

因此,在 quickstart.py 中进行以下更改,

creds = flow.run_local_server(port=0) 

到,

creds = flow.run_local_server(port=8080) 

http://localhost:8080/ 位于 URI 列表中时。

关于python - Google Drive API Quickstart.py 错误 400 : redirect_uri_mismatch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63956706/

相关文章:

android - 谷歌播放服务 sdk : Requesting for offline access during auth

python 在转换\添加之前处理 Nonetype

python - 通过对列进行分组来合并 pandas 数据框的行

google-apps-script - 如何对 Google 文档/云端硬盘文档中的标题进行编号?

google-apps-script - DriveApp.continueFileIterator(continuationToken) 的正确用法

node.js - 是否可以使用 IAM 在 gcloud 托管的应用程序内以 Google 用户身份进行身份验证?

python - Sympy:从数值上找到符号函数的根

python - 用于 Android 和 utf-16-be 编码的 Pygame 子集

java - 如何在不重复的情况下在谷歌驱动器中创建文件夹?