Google表格API:来电者没有权限

And*_*dar 14 google-sheets google-apis-explorer google-sheets-api

我正在尝试从cron中读取文档:

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

任何有链接的人都可以使用我的文档.


My #1 key settings:    
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - I added my external IP address.
 - API restrictions - none
Run Code Online (Sandbox Code Playgroud)
My #2 key settings:
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - I added my external IP address.
 - API restrictions - Google Sheets API
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
My #4 key settings:
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - none
 - API restrictions - Google Sheets API
Run Code Online (Sandbox Code Playgroud)
My #5 key settings:
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - none
 - API restrictions - Google Sheets API, Google Drive API
Run Code Online (Sandbox Code Playgroud)
My #6 key settings:
Application restrictions:

 - IP addresses (web servers, cron jobs, etc.) - none
 - API restrictions - none
Run Code Online (Sandbox Code Playgroud)

当我尝试用每个键打开文档时,我收到403错误:

{
  "error": {
    "code": 403,
    "message": "The caller does not have permission",
    "status": "PERMISSION_DENIED"
  }
}
Run Code Online (Sandbox Code Playgroud)

使用API​​ Explorer时会出现同样的错误(https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/get).

同时,文档本身可以从任何计算机和任何浏览器的链接成功打开,甚至可以打开未经授权的用户.

此问题始于7月9日晚上9:35(UTC + 0).

在此错误之前,我使用了成功从文档中接收数据#1 key settings.

更新:

我发现了另一个奇怪的细微差别:在所有其他文件上没有这样的问题.在一个特定文档上观察到错误.我将访问设置与其他设置进行了比较 - 它们完全相同.

更新2:

我试图复制表并通过API打开它 - 错误是一样的.一个小时后我再次尝试 - 一切都奏效了.

thi*_*ice 2

看到HoverPhoenix评论后,我将“我的工作表”的访问权限更改为“查看器模式下有链接的任何人**” 。

访问图像示例

更改访问权限后,它可以正常工作。如果担心数据安全,那么最好的选择是使用 OAuth 2.0 客户端 ID 作为凭据。