python - Google Drive API Quickstart.py 错误 400:redirect_uri_mismatch
问题描述
我正在使用https://developers.google.com/drive/api/v3/quickstart/python访问 Google Drive Api,但 Google 不断抛出redirect_uri_mismatch
错误。
我将错误中的 localhost:number 添加到 Web 应用程序的客户端 ID 中的授权重定向 URI,但是每当我运行 时quickstart.py
,本地主机号都会更改。
我在 StackOverflow 上看到有很多关于这个问题的问题,我已经花了几个小时来解决我的问题,但我还没有找到似乎可以为我解决问题的答案。
有任何想法吗?
尝试过的答案,除其他外,
目前
解决方案
Tanaike的评论和回答在这里有效:Google APIs OAuth 2.0 redirect_uri_mismatch 错误
因此,在quickstart.py
中进行以下更改,
creds = flow.run_local_server(port=0)
到,
creds = flow.run_local_server(port=8080)
何时http://localhost:8080/
在 URI 列表中。
推荐阅读
- mysql - 无法通过 3306 端口连接到远程 MYSQL 服务器
- kubernetes - 如何在 GKE(谷歌 kubernetes 引擎)中运行 kubeadm 命令
- c++ - 强制在分配运算符中使用隐式强制转换
- mongoose - 无法将路径“stats”的默认值设置为 mongoose Schema 实例
- python - 模组龟最有属性的形状?
- docker - 如何对 docker 服务的复制进行稍微不同的配置
- cassandra - Cassandra not working after upgrade Ubuntu to 20.04
- vue.js - 如何部署 Vue.JS MPA(多页面应用程序)
- regex - 将 awk 用于 if 语句和拆分
- string - 如何在rust中返回字符串向量