错误:redirect_uri_mismatch pydrive [英] Error: redirect_uri_mismatch pydrive

查看:102
本文介绍了错误:redirect_uri_mismatch pydrive的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到Google驱动器,为此,我正在使用python pydrive库.我已按照文档进行操作,并编写了一段用于与Google Drive连接的代码段.但我得到一个错误 错误:redirect_uri_mismatch

I am trying to connect to google drive and for that I am using python pydrive library. I have followed the documentation and written a snippet for connecting with google drive. But I get an error Error: redirect_uri_mismatch

请求中的重定向URI http://localhost:8080/与授权的URL不匹配用于OAuth客户端.要更新授权的重定向URI

The redirect URI in the request, http://localhost:8080/, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs

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

Here is the code of pydrive that I have executed (I have installed the pydrive library as well)

from pydrive.auth import GoogleAuth

gauth = GoogleAuth()
gauth.LocalWebserverAuth()

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

I am posting an image of my console.developer account, you can see I have written the address correctly as specified by the pydrive documentation. I have also added outcallback in the url but I am still getting the same error. Any help will be appreciated. Thanks

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

This is my client_secrets.json file content:

{"web":{,"project_id":"my-project-1532814702018","auth_uri":" https://accounts.google.com/o/oauth2/auth ," token_uri:" https://accounts.google.com/o/oauth2/token ," auth_provider_x509_cert_url:" http://localhost:8080 "]}}

{"web":{,"project_id":"my-project-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和客户机密)

(I have removed client id and client secret here)

推荐答案

我现在知道有点晚了,但是它可能会对遇到此问题的人有所帮助. 对我来说,这真是愚蠢.在授权重定向URI"字段中,它必须为" http://localhost:8080/",并在末尾加斜杠.在"JavaScript授权来源"中,必须为" http://localhost:8080 ".

I know its a bit late now, but it may help someone who encounters this issue. For me it was really silly. In "Authorized redirect URIs" field it must be "http://localhost:8080/" with a slash at end. In "Authorized JavaScript origins" it must be "http://localhost:8080" without a slash.

这篇关于错误:redirect_uri_mismatch pydrive的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆