[英]Google Drive API token with Node Js
您好,我正在使用Google Drive API,并成功生成了其令牌。
json对象如下所示:
{
"access_token": xxxx,
"refresh_token": xxxx,
"token_type": "Bearer",
"expiry_date": xxxx
}
我可以成功发出请求(即下载文件),但我不知道它的到期时间。 我通读了它的API文档,但我不太明白。
如果#1是正确的,那么我应该删除“ refresh_token”以外的所有其他字段吗?
{ "refresh_token": xxxx }
我要实现的是...保留一个永不过期的令牌。 但是,一个小时后,我尝试从Google云端硬盘下载文件,但返回的内容如下:
{ "access_token" : xxxx, "expires_in" : 3600, "token_type" : "Bearer" }
看来已过期。 您是否需要再次为Google Drive API生成令牌? Google Spreadsheet没有问题。 只有Google云端硬盘。
提前非常感谢您。
哦,范围是
['https://www.googleapis.com/auth/drive.readonly']
access_token
有效期应为一个小时左右(如您在#3中提到的一样),因此应安全地在该时间段后将其丢弃。 但是您不是出于日志记录的原因要保留它吗? refresh_token
要求另一个access_token
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.