Triggers G应用程序脚本工作表反复请求授权,尽管已多次授予授权(时间驱动触发器)

Triggers G应用程序脚本工作表反复请求授权,尽管已多次授予授权(时间驱动触发器),triggers,authorization,spreadsheet,Triggers,Authorization,Spreadsheet,从2018年6月21日凌晨1:59,在一份背景为脚本的谷歌电子表格上,我反复要求授权,并发送“谷歌应用程序脚本失败摘要”电子邮件,内容如下 启动功能错误消息触发器结束 18年6月21日凌晨3:54执行该操作需要ScanGmail授权。基于时间的2018年6月21日凌晨3:54 我已经多次使用'function auth(){}'再次授予授权(似乎每次我注销或计算机进入睡眠模式时都必须这样做) 我还实现了授权脚本,但没有发送授予授权的电子邮件,只有应用程序脚本错误通知 var addonTitle

从2018年6月21日凌晨1:59,在一份背景为脚本的谷歌电子表格上,我反复要求授权,并发送“谷歌应用程序脚本失败摘要”电子邮件,内容如下

启动功能错误消息触发器结束 18年6月21日凌晨3:54执行该操作需要ScanGmail授权。基于时间的2018年6月21日凌晨3:54

我已经多次使用'function auth(){}'再次授予授权(似乎每次我注销或计算机进入睡眠模式时都必须这样做)

我还实现了授权脚本,但没有发送授予授权的电子邮件,只有应用程序脚本错误通知

var addonTitle = 'PRE_Inv_Conf';
var props = PropertiesService.getDocumentProperties();
var authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL);

// Check if the actions of the trigger requires authorization that has not
// been granted yet; if so, warn the user via email. This check is required
// when using triggers with add-ons to maintain functional triggers.
if (authInfo.getAuthorizationStatus() ==
   ScriptApp.AuthorizationStatus.REQUIRED) {
// Re-authorization is required. In this case, the user needs to be alerted
// that they need to re-authorize; the normal trigger action is not
// conducted, since it requires authorization first. Send at most one
// "Authorization Required" email per day to avoid spamming users.
var lastAuthEmailDate = props.getProperty('lastAuthEmailDate');
var today = new Date().toDateString();
if (lastAuthEmailDate != today) {
  if (MailApp.getRemainingDailyQuota() > 0) {
    var html = HtmlService.createTemplateFromFile('AuthorizationEmail');
    html.url = authInfo.getAuthorizationUrl();
    html.addonTitle = addonTitle;
    var message = html.evaluate();
    MailApp.sendEmail(Session.getEffectiveUser().getEmail(),
                       'Authorization Required',
                       message.getContent(), {
                         name: addonTitle,
                         htmlBody: message.getContent()
                       }
                      );
  }
   props.setProperty('lastAuthEmailDate', today);
 }
} else {

在CET时间6/21/18凌晨1:59,谷歌方面是否发生了变化,或者出现了什么问题,有没有办法避免这种行为?

这似乎是一个谷歌错误,因为在受影响的电子表格或相关的谷歌账户上,我方没有发生任何变化。不确定它是否出现,因为我运行多个谷歌帐户,但这是我的解决方案

  • 断开与所有帐户的连接
  • 关闭使用过的浏览器
  • 再次打开浏览器
  • 打开一扇不知名的窗户
  • 登录到拥有电子表格(或用于设置触发器)的帐户
  • 通过脚本编辑器->编辑->当前projet的触发器删除所有触发器
  • 保存此无触发器选择
  • 重新打开触发器设置(编辑->当前projet的触发器)
  • 再次设置所有触发器并再次授予授权
  • 到目前为止,这个解决方案似乎修复了谷歌的bug。电子表格和后台的脚本现在运行得与预期的一样/与CET时间06/21/18凌晨1:59之前的一样