错误:redirect_uri_mismatch pydrive

问题描述 投票:0回答:2

我正在尝试连接到谷歌驱动器,为此我使用python pydrive库。我已经按照文档编写了一个片段,用于连接谷歌驱动器。但我得到一个错误错误:redirect_uri_mismatch

请求中的重定向URI(http://localhost:8080/)与为OAuth客户端授权的URI不匹配。更新授权的重定向URI

这是我执行的pydrive代码(我已经安装了pydrive库)

from pydrive.auth import GoogleAuth

gauth = GoogleAuth()
gauth.LocalWebserverAuth()

我发布了我的console.developer帐户的图像,您可以看到我已按照pydrive文档的指定正确编写了地址。我还在网址中添加了outcallback,但我仍然遇到同样的错误。任何帮助将不胜感激。谢谢Console.developers account

Added outhcallback

这是我的client_secrets.json文件内容:

{ “网”:{ “PROJECT_ID”: “我的项目 - 1532814702018”, “auth_uri”: “https://accounts.google.com/o/oauth2/auth”, “token_uri”: “https://accounts.google.com/o/oauth2/token”, “auth_provider_x509_cert_url”: “https://www.googleapis.com/oauth2/v1/certs”, “redirect_uris中”:“http://localhost:8080/oauth2callback “],” javascript_origins “:[” http://localhost”, “http://localhost:8080”]}}

(我在这里删除了客户端ID和客户端密码)

python-3.x google-drive-sdk pydrive
2个回答
0
投票

你快到了。只需添加灰色文本中指示的'/ oauth2callback'即可。

因此,在“授权重定向URI”下:

http://localhost:8080/oauth2callback

0
投票

编辑您的URL并用http://localhost:8080/替换http://localhost:8080

这个对我有用


0
投票

似乎谷歌API已经改变了他们在授权域上的政策,我听说有远程域重定向到localhost?或者您可以更改您的主机文件...它没有意义,因为谷歌支持在本机应用程序上使用api,为什么他们需要域名?

© www.soinside.com 2019 - 2024. All rights reserved.