"You do not have permission to call showModalDialog"

"You do not have permission to call showModalDialog"

我们第一次注意到这个问题是在 6 月 8 日星期五。它可能已经潜伏了一段时间,因为我们不经常使用该插件。我们首先从 script.google.com 上的项目 运行 "Test as add-on..." 中看到它,而不管被测试的代码版本如何。然后,我们让多个用户使用从 G Suite Marketplace 下载的 public 插件从他们自己的帐户中重现该问题。 public 插件可追溯到 5 月 2 日,发布时运行良好。

打开 Google Drive 中的任何 sheet,并获取 Workforce Dimensions Admin 插件。选择 "Generate settings file" 并收到错误消息 "You do not have permission to call showModalDialog"。

这是一个影响其他附加组件的已知问题吗?

来自comment #65 to Critical: Google Docs Add ons show error "You do not have permission to call showSidebar"

Hello,

We have introduced a new scope - "https://www.googleapis.com/auth/script.container.ui". For most add-ons the new scope requirement should have been added to the add-on automatically. In this case Apps Script did not detect that the add-on requires the scope because the reference to the top level bean "SpreadsheetApp" is in a different file than the function "showSidebar()". In order to resolve similar issues, developers should ensure both top level bean and bean method are referenced in the same file or explicitly declare all scopes requirements in the manifest. For more information on explicit scopes, please reference https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes.

Thanks, Peter


是的,这是一个已知问题,因为 Google Apps 脚本问题跟踪器最近出现了几个问题,如下所示:

问题仍然没有被 Google 解决,即使添加 googleapis.com/auth/script.container.ui 作用域对我来说也没有任何改变,但我找到了不同的方法:

您所要做的就是在您项目的触发器中手动创建 onEdit 触发器,因此范围将是有效的。它对我有用,问题可能出在您使用的是简单触发器而不是可安装触发器。