google-api - Google Drive API 1.8.1 - 大文件上传/下载问题

标签 google-api google-oauth google-api-dotnet-client

当我上传或下载一个大文件并且持续时间超过一小时时,上传/下载会在一小时后中断并显示以下错误消息:

Google.GoogleApiException: Google.Apis.Requests.RequestError
Invalid Credentials [401]
Errors [
    Message[Invalid Credentials] Location[Authorization - header] Reason[authError] Domain[global]
]

无论我使用 Web 授权还是服务帐户授权来运行它,都没有区别。

我不确定这是否与AuthToken过期有关,因为如果我上传较小的文件,那么我可以上传很多文件,并且一个小时后不会中断。对于小文件,一切都运行顺利并且可以工作很长时间。

看起来描述了类似的问题 here ,但这个问题尚未得到解答。

我的代码如下:

DriveService service;

// ....

FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, mimeType);
request.Upload();

最佳答案

问题出在 Google 云端硬盘端点上,无法在您的代码中修复。

有人提交了 an issue about this截至2013年1月13日,一年多过去了,谷歌似乎没有对此进行任何更新,而其他人仍然遇到这个问题。

This is an issue with the backend and not with the API or with your code. As you deduced, if the upload goes too long the access_token expires and at that point the resumable upload can't be continued. There is work on progress to fix this issue right now, I will update this bug once the issue is fixed on the server side.

这是another report关于这个问题。

关于google-api - Google Drive API 1.8.1 - 大文件上传/下载问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23696484/

相关文章:

oauth-2.0 - Google Oauth token 限制

c# - 如何以编程方式从 Google 驱动器中的 "share with me"中删除文件

.net - 未经用户同意使用 youtube Data API V3 将视频自动上传到我的帐户

c# - YouTube上传API-离线获取Auth token

javascript - Google Drive API - 未列出特定的共享驱动器

javascript - 如何使用 jQuery 处理 Google Suggest 查询

node.js - 使用仅具有访问 token 的 Google API 发送电子邮件

oauth - 如何为 Google OAuth 设置回调 URL?

即使在生产中,django-allauth 使用 google 登录也会重定向到开发 url

google-apps-script - 如何将drive.file范围用于独立的Google Apps脚本