invalid_grant使用服务帐户和Google Drive API返回

本文关键字:Google Drive API 返回 grant 服务 invalid | 更新日期: 2023-09-27 18:00:30

我花了两天时间使用服务帐户来处理各种Drive API教程。

我最近使用的教程是这样的:https://developers.google.com/drive/delegation

我在尝试上传文件时不断收到这个错误:

ProtocolException was unhandled
Error occurred while sending a direct message or getting the response.

我安装了Fiddler,并确定当POST /o/oauth2/token返回时:

{
    "error:"invalid_grant"
}

我已经仔细检查了我的申请范围。

我做错了什么?

invalid_grant使用服务帐户和Google Drive API返回

原来我的服务器上的时间快了5分钟。

当我在服务器上更正时间时,一切都正常了。

我认为这导致了某种身份验证问题,因为谷歌服务器时间不接受来自我的服务器或类似的请求的时间戳。。。

(希望这能省去一些麻烦)