2
votes

I've written a Google Apps Script web app to allow users to change their gmail signature using a html form template via the Gmail API. This has been working for a few months but has suddenly stopped working. The console error I get is:

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)

This error refers to the use of this line of code:

Gmail.Users.Settings.SendAs.patch(newSig, "me", Session.getActiveUser().getEmail());

SendAs.patch requires the following authorization:

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

After deleting the previously stored permissions and re-running the app the authorization window lists the following permissions:

enter image description here

Note that "Manage your basic email settings" (gmail.settings.basic) is missing. So, what am I doing wrong? Can I rectify this, or is this a gmail-api auth bug?

According to https://developers.google.com/apps-script/guides/services/authorization :

Apps Script determines the authorization scopes (like access your Google Sheets files or Gmail) automatically, based on a scan of the code. Code that is commented out can still generate an authorization request. If a script needs authorization, you'll see one of the authorization dialogs shown here when it is run.

Is there any way to manually request an auth permission?

1
same here, it was working like 5mins ago. have you found solution for this issue?darkfolcer

1 Answers

0
votes

use this scope:

https://mail.google.com/

to have full access. You shouldn't have problem with scopes/authorization with that.