当文档指出授权是可选的,并且仅需要API密钥时,我收到监视文件请求的401授权错误。 https://developers.google.com/drive/api/v3/reference/files/watch
我设置了一个模拟服务器来接收通知,并在Postman中对其进行了测试。
我已发布到“ https://www.googleapis.com/drive/v3/files/[fileId]/watch”。 这是我的请求正文:
{
"kind": "api#channel",
"id": [UUID],
"resourceId": [fileId],
"resourceUri": "http://[url]/notification",
"type": "web_hook",
"params": {
"key": [key]
}
}
这是我得到的错误。
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}