【发布时间】:2018-02-12 12:35:50
【问题描述】:
我编写了一个 Google Apps Script Web 应用程序,允许用户通过 Gmail API 使用 html 表单模板更改他们的 gmail 签名。这已经工作了几个月,但突然停止工作。我得到的控制台错误是:
mae_html_user_bin_i18n_mae_html_user.js:40 Uncaught Error: Missing required scope "https://www.googleapis.com/auth/gmail.settings.basic" for modifying primary SendAs
at setSignature (Code:151) (Email Signature Generator:21)
这个错误是指使用这行代码:
Gmail.Users.Settings.SendAs.patch(newSig, "me", Session.getActiveUser().getEmail());
SendAs.patch 需要以下授权:
https://developers.google.com/gmail/api/v1/reference/users/settings/sendAs/patch
https://www.googleapis.com/auth/gmail.settings.basic
https://www.googleapis.com/auth/gmail.settings.sharing
删除之前存储的权限并重新运行应用后,授权窗口会列出以下权限:
请注意,缺少“管理您的基本电子邮件设置”(gmail.settings.basic)。那么,我做错了什么?我可以纠正这个问题,还是这是一个 gmail-api 身份验证错误?
根据https://developers.google.com/apps-script/guides/services/authorization:
Apps 脚本确定授权范围(例如访问您的 Google 表格文件或 Gmail)自动,基于扫描 代码。被注释掉的代码仍然可以生成授权 要求。如果脚本需要授权,您将看到其中一个 运行时此处显示的授权对话框。
有没有办法手动请求授权?
【问题讨论】:
-
这里也一样,它在 5 分钟前还在工作。您找到解决此问题的方法了吗?
标签: google-apps-script gmail-api