【发布时间】:2017-05-21 16:37:54
【问题描述】:
我有一个小型 Google Apps 脚本,已部署为 API 可执行文件。
虽然我已经使用我正在使用的范围(电子表格)的有效令牌进行了调用,但我无法通过这个 403 PERMISSION_DENIED 错误。
我现在正在API's Explorer 上测试这个,但出现了同样的错误。
有人知道我可能会错过什么吗?
我的脚本很简单(仍然不完整,但它可以运行 - 对于这些初始测试应该足够了):
OAuth Scope required by script (copied from API's Explorer):
https://www.googleapis.com/auth/spreadsheets
function myFunction(get) {
var ss = SpreadsheetApp.openById("1axDlnPaoEwhlb_Vs5SLBvkGJrR-fSeOLuHEdSBXCTBg"); // I'm not getting anything from the sheet at this point, I included it just to make sure that the script requires the spreadsheets scope
get += " " + "success!";
return ContentService.createTextOutput(get);
}
请求(从 API 的资源管理器中复制):
POST https://script.googleapis.com/v1/scripts/1d1EKj7vi-gzC0gB02qjw_qBPE1zSrZtJp-YUWuKm3NL3-3t6Sixpm0TZ:run?key={YOUR_API_KEY}
{
"function": "myFunction",
"parameters": [
"Hello world!"
]
}
响应(从 API 的资源管理器中复制):
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
【问题讨论】:
标签: google-apps-script google-cloud-platform