在我运行以下代码后: https://developers.google.com/drive/api/v3/quickstart/python
我得到链接:
https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=792377765624-8l03cnfmj1km5gd27227kuaem37okdip.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A41245%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&state=8xHuMrgWMisZa7Hww6HpIZrRdkRTjq&access_type=offline
我点击它并获得新页面。
这里不允许上传图片,抱歉。
因为我在stackoverflow的分数很低
最后,它告诉我无法连接到:
http://localhost:44637
行为截图:https://blog.csdn.net/appleyuchi/article/details/102940981
最佳答案
根据您提供的屏幕截图和您重定向到的网址,问题是您下载凭据文件所用的 Google 帐户与您授予云端硬盘授权的帐户不同。两者应该相同,因为凭据文件包含标识下载它们的帐户的信息。
检查这些以获取有关身份验证过程的更多信息:
https://developers.google.com/identity/protocols/OAuth2 https://developers.google.com/identity/protocols/OAuth2WebServer
关于google-drive-api - 重定向到本地主机后上传失败谷歌 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58658088/