为什么我的应用程序脚本作为API可执行文件部署返回权限被拒绝? [英] Why does my apps script deployed as API executable return Permission Denied?

查看:123
本文介绍了为什么我的应用程序脚本作为API可执行文件部署返回权限被拒绝?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在脚本编辑器中创建了一个脚本,并将其发布为部署为API可执行文件。在这个脚本里面,我提供了一个doc_id给我的工作表,并定义了一个函数来从表中获取数据。

然后我去了https://developers.google.com/apps-script/execution/rest/v1/scripts/run 进行测试执行API。我添加了范围,授权应用程序并尝试了它。我收到以下错误消息:

 error:{
code:403,
message:调用者没有权限,
status:PERMISSION_DENIED
}

有人能告诉我我做错了什么吗?

解决方案

确保应用程序脚本是与正确的开发控制台项目相关联。

该脚本应该与开发者控制台项目ID相关联,与所使用的OAuth 2.0客户端ID相对应(此开发者控制台项目也应该具有应用程序脚本执行API启用)。



要更改应用程序脚本的开发人员控制台项目,请选择以下菜单项:资源>开发人员控制台项目...



在此屏幕上输入您的开发控制台的项目编号。


I created a script in the script editor, published it as a "Deploy as API executable". Inside this script, I provided a doc_id to my sheet and defined a function to get data from that sheet.

I then went to https://developers.google.com/apps-script/execution/rest/v1/scripts/run to test the execution API. I added the scopes, authorized the app and tried it. I am getting the following error message:

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

Can someone tell me what I am doing wrong?

解决方案

Make sure the app script is associated with correct dev console project.

The script should be associated with the dev console project id that corresponds with OAuth 2.0 client ID used (this dev console project should also have "Apps Script Execution API" enabled).

To change the developer console project for an app script select the following menu item: Resources > Developer Console Project...

On this screen enter the project number for your dev console.

这篇关于为什么我的应用程序脚本作为API可执行文件部署返回权限被拒绝?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆