谷歌应用程序脚本ui显示模式需要驱动器访问



我有两个谷歌账户#user1和#user2。

使用#user1我创建了一个简单的应用程序脚本插件:

function onInit() {
const section = CardService.newCardSection();
section.addWidget(CardService.newTextButton().setText("Open HTML")
.setOnClickAction(CardService.newAction().setFunctionName("openHtml")));
return CardService.newCardBuilder()
.setName("Cart name")
.addSection(section)
.build();
}
function openHtml() {
const html = HtmlService.createHtmlOutput("<h1>Enter feedback</h1>");
DocumentApp.getUi().showModalDialog(html, "Modal title");
}

当我点击"打开HTML"按钮时,在模式对话框中我会得到"你需要访问"表单

但在这个表单中,我检测到自己是#user2。如果我注销#user2,那么modal会正确打开。

可能是我需要设置一些设置,或者这是错误?

这是我的appscript.json

{
"timeZone": "Europe/Kiev",
"dependencies": {},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8",
"oauthScopes": [
"https://www.googleapis.com/auth/documents.currentonly",
"https://www.googleapis.com/auth/spreadsheets.currentonly",
"https://www.googleapis.com/auth/script.container.ui"
],
"addOns": {
"common": {
"name": "Test",
"logoUrl": "https://www.gstatic.com/images/icons/material/system/1x/people_black_24dp.png",
"layoutProperties": {
"primaryColor": "#2772ed"
},
"homepageTrigger": {
"runFunction": "onInit"
}
},
"docs": {},
"sheets": {}
}
}

这确实是个bug

多个登录的问题是众所周知的,你可以在谷歌的问题跟踪器上找到几个相关的问题:

  • https://issuetracker.google.com/186665176
  • https://issuetracker.google.com/175707203
  • https://issuetracker.google.com/171364500
  • https://issuetracker.google.com/72798638
  • https://issuetracker.google.com/69270374
  • https://issuetracker.google.com/72798634

不幸的是,在解决此问题之前,您的最佳选择是避免使用多个帐户登录到同一浏览器会话中。

最新更新