首页 > 解决方案 > 无法订阅 Google Drive 推送通知

问题描述

基于: https ://developers.google.com/drive/api/v3/push

我不明白从哪里得到auth_token_for_current_user

我有服务帐户凭据,还有一个 OAuth 令牌。我试过了access_tokenrefresh_token......我不明白这应该是什么令牌。

  curl --location --request POST 'https://www.googleapis.com/drive/v3/changes/watch' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 1//064ToBH1n***' \
--data-raw '{ 
    "id":"***", 
    "type": "web_hook", 
    "address": "https://***.cloudfunctions.net/verify" 
}'

返回:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "authError",
    "message": "Invalid Credentials",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Invalid Credentials"
 }
}

谢谢你的帮助。

标签: google-drive-api

解决方案


推荐阅读