google-sheets - 无需Oauth token 即可访问Google电子表格API

标签 google-sheets google-spreadsheet-api google-authentication google-developers-console

我已经阅读了Google电子表格文档https://developers.google.com/sheets/api/guides/authorizing,它说,如果文档是公开的,则不需要Oauth 2.0,并且API key 就足够了。我正在尝试使用hurl和api键作为parameter.it发出测试请求,但是它仍然给我错误,我需要使用Oauth,有什么想法吗?

POST https://sheets.googleapis.com/v4/spreadsheets/16woR-nfy6KYBbkQpC2YOT1GzIean8rTzjueUnlzLMiE/values/Sheet1!A1:E1:append?valueInputOption=USER_ENTERED

回复:"error": {"code": 401,"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status": "UNAUTHENTICATED"}

最佳答案

API key 还不够。您正在尝试使用需要OAuth授权的spreadsheets.values.append:

Authorization Requires one of the following OAuth scopes:

https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets
For more information, see the [Auth Guide](https://developers.google.com/identity/protocols/OAuth2).


请注意,它显示为OAuth。

关于google-sheets - 无需Oauth token 即可访问Google电子表格API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48747530/

相关文章:

node.js - 内部 OAuth 错误 : Failed to fetch user profile NodeJs+passport-google-oAuth2

python - Google Adword API 使用 generate_refresh_token.py 生成刷新 token

google-apps-script - 如何对多个可更新的电子表格使用一个代码,尝试使用库

google-apps-script - Sheet.getRange(1,1,1,12) 括号中的数字表示什么?

php - 使用 Google Sheet API 在电子表格中添加(创建)新工作表

xpath - Google 表格 - 在特定页面上导入 XML 时遇到问题

sorting - Google Apps 脚本附加排序规则

java - 如何增加 Google HTTP 客户端中的 ReadTimeout

google-sheets - 如何将条件格式应用于命名范围?

java - 如何通过 Google V4 Java API 获取工作表列表