我有一個小的Google Apps腳本,我已將其部署爲API可執行文件。 雖然我用我使用的範圍(電子表格)的有效標記進行了調用,但我無法通過此403 PERMISSION_DENIED
錯誤。 我現在正在API's Explorer上測試這個錯誤。Google API可執行權限被拒絕錯誤
有沒有人有任何想法可能會失蹤?
我的腳本是簡單的(還沒有完成,但它運行 - 這應該對這些最初的測試是不夠的):
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"
}
}
問題是第一點:我的腳本與錯誤的控制檯項目相關聯。 – jony