小编Ole*_*nko的帖子

如何缩小谷歌应用程序脚本的身份验证/驱动范围?

我已经构建了一个谷歌应用程序脚本网络应用程序。对于 Google Drive 相关功能,应用程序需要auth/drive.install(与 Drive UI 集成)和auth/drive.file(在相关文件属性中存储与文件关联的一些数据)范围。其他的范围是auth/urlshortenerauth/userinfo.emailauth/userinfo.profile。据我了解,出于身份验证目的,需要后两者。

上述范围在应用程序中的 oauth dance 中指定。但是,在应用安装时,会向用户显示以下范围:

  • 查看和管理您的 Google Drive 中的文件(对应于auth/drive scope
  • 管理您的 goo.gl 短网址 ( auth/urlshortener)
  • 和其他三个与auth/script_*范围相对应的

这与脚本属性的范围相关。

5 OAuth Scopes required by the script:

https: //www.googleapis.com/auth/drive
https: //www.googleapis.com/auth/script.external_request 
https: //www.googleapis.com/auth/script.scriptapp 
https: //www.googleapis.com/auth/script.storage 
https: //www.googleapis.com/auth/urlshortener
Run Code Online (Sandbox Code Playgroud)

显然,auth/drive并且auth/urlshortner是由于使用高级 Google 服务而添加的,这些服务在 GAS IDE(资源 > 高级 Google 服务)和开发人员控制台中都已打开。

GAS IDE 不允许指定任何比 eg 更窄的范围auth/drive。出于某种原因,开发人员控制台中的 Google Apps Marketplace SDK 配置不允许添加任何特定范围。实际上,它允许添加但不保存任何内容。 …

google-apps-script google-console-developer

2
推荐指数
1
解决办法
1588
查看次数