首页 > 解决方案 > Google Script Add-on 需要访问未使用的范围

问题描述

我已经使用谷歌应用程序脚本为谷歌电子表格构建了一个插件,但我无法弄清楚它为什么要求云端硬盘权限。未Drive API启用,我没有DriveApp在项目中的任何地方使用类,并且driveapp范围也没有在任何地方定义,但它显示在 OAuth 授权屏幕中并使应用程序未经验证: 在此处输入图像描述 在此处输入图像描述

这些是项目属性的范围: 在此处输入图像描述

文件中定义的范围appscript.json

"oauthScopes": [
    "https://www.googleapis.com/auth/analytics.edit",
    "https://www.googleapis.com/auth/analytics.readonly",
    "https://www.googleapis.com/auth/script.container.ui",
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/script.scriptapp",
    "https://www.googleapis.com/auth/script.send_mail",
    "https://www.googleapis.com/auth/spreadsheets",
    "https://www.googleapis.com/auth/userinfo.email"
  ]

最后,在 Google Cloud Platform 中授权的范围,OAuth 同意屏幕: 在此处输入图像描述

标签: google-apps-scriptgoogle-cloud-platformoauthscopes

解决方案


似乎我driveapp在 G Suite Marketplace 配置中添加了范围,并且 OAuth 屏幕在删除该范围后不再要求驱动器权限。“未验证”应用消息也不再显示。


推荐阅读