Google Sheets API: The caller does not have permission

一世执手 提交于 2019-12-18 10:36:18

问题


I'm trying to read the document from the cron:

https://sheets.googleapis.com/v4/spreadsheets/<sheet_id>?key=<api_key>

My document is available to anyone with the link.


My #1 key settings:    
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - I added my external IP address.
 - API restrictions - none

My #2 key settings:
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - I added my external IP address.
 - API restrictions - Google Sheets API

My #3 key settings:
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - I added my external IP address.
 - API restrictions - Google Sheets API, Google Drive API

My #4 key settings:
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - none
 - API restrictions - Google Sheets API

My #5 key settings:
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - none
 - API restrictions - Google Sheets API, Google Drive API

My #6 key settings:
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - none
 - API restrictions - none

When I try to open a document with each key, I get a 403 error:

{
  "error": {
    "code": 403,
    "message": "The caller does not have permission",
    "status": "PERMISSION_DENIED"
  }
}

The same error occurs when using the API Explorer (https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/get).

At the same time, the document itself opens successfully from a link from any computer and from any browser even to unauthorized users.

This problem began on July 9 at 09:35 PM (UTC+0).

Prior to this error, I successfully received data from the document using the #1 key settings.

Update:

I found another strange nuance: on all other documents there is no such problem. An error is observed on one particular document. I compared the access settings with others - they are identical.

Update 2:

I tried to copy the table and open it via API - the error was the same. An hour later I tried again - it all worked.

来源:https://stackoverflow.com/questions/51261332/google-sheets-api-the-caller-does-not-have-permission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!