Specifying Requested OAuth Scopes - Editor Add On Project

Skip to first unread message

Afaan Naqvi

Dec 1, 2023, 6:02:59 AM12/1/23
to Google Apps Script Community
Hi there - first time poster, self-taught coder, and trying to get my very first App Published to the Marketplace.

I want to deploy the app as a Sheets Editor Add on (so no manifest file, and no use of the Cards service).

The app is stuck in review due to the use of OAuth Scopes requested, with the review team rightfully advising me to use the "https://www.googleapis.com/auth/gmail.modify" scope instead of the "https://mail.google.com/" scope as the modify scope does provide the narrowest minimum scope needed to achieve all the functionality of my app.

However, given this is a Google Sheets Editor Add on, I am not sure how to change or explicitly set the "https://www.googleapis.com/auth/gmail.modify"  rather than the "https://mail.google.com/" requested scope. I tried 1 version of the App using the GmailApp service and it automatically sets the project requested scope to "https://mail.google.com/"

I then tried a second version in which I swapped the GmailApp service for the Gmail.Users service, hoping it would recognize that I only need the "https://www.googleapis.com/auth/gmail.modify"  scope, but the project still automatically ends up requesting the "https://mail.google.com/" scope.

I tried swapping my Google Cloud Console project to reflect that I only need the "https://www.googleapis.com/auth/gmail.modify" scope, but of course then the GCC project scope list does not match the actual Apps Script project requested scope list, and when I try to submit the App for verification on Google Cloud Console using the "https://mail.google.com/" scope (so that the requested scopes match between GCC and my Apps Script project) the review team insists again that I narrow the requested scope down to "https://www.googleapis.com/auth/gmail.modify"

Sorry for the long-winded message, but I figured better to give all the details in one go.
I would be eternally grateful for any help or advice on how to resolve this.



Martin Molloy

Dec 1, 2023, 7:36:51 PM12/1/23
to google-apps-sc...@googlegroups.com
In the apps script editor
Click on Project Settings
Tick the box that says "Show "appsscript.json" manifest file in editor"
Select the Editor
You should see your appscript.JSON file - open that
You may need to add a section to the JSON for the scopes or just edit the existing scopes if they are listed
you should end up with something like this:
ie the scopes need to be in the square brackets

hope that helps


You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/eff4dec3-4d23-45f4-a246-acf90c5673fcn%40googlegroups.com.

Afaan Naqvi

Dec 2, 2023, 2:06:20 AM12/2/23
to Google Apps Script Community
Hi Martin,

Thank you for that. I did figure this out shortly after posting (and it worked!) but really pleased to see that it is also how an expert on the community proposed to accomplish this.
Not sure if there is a way to mark this thread as resolved or upvote it, but I'll look now to see if there is a way to do that or similar. Thanks again for reading and for your reply.


Andrew Roberts

Dec 4, 2023, 6:54:30 AM12/4/23
to google-apps-sc...@googlegroups.com

Afaan Naqvi

Dec 4, 2023, 8:06:07 AM12/4/23
to Google Apps Script Community
Thanks Andrew - I was in fact missing the gmail.modify scope from the list in the SDK section of the GCP project. The rest of the scopes were already correctly reflected there.
Thanks for the reminder - much appreciated.


Reply all
Reply to author
0 new messages