Search code examples
google-apps-scriptgoogle-cloud-platformgoogle-oauthadd-on

Can not publish Google Calendar AddOn due missing explicit scopes - but why?


I am trying to publish my Google Addon but I receive the following error:

enter image description here

Which says that in order to publish an explicit list of oauthScopes is needed.

This is the oauthscope part of my appscript.json :

 "oauthScopes": [
"https://www.googleapis.com/auth/script.locale",
"https://www.googleapis.com/auth/calendar.addons.execute",
"https://www.googleapis.com/auth/calendar",
"https://www.googleapis.com/auth/script.external_request",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/script.scriptapp",
"https://www.googleapis.com/auth/admin.directory.user.readonly",
"https://www.googleapis.com/auth/admin.directory.group.member.readonly",
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.googleapis.com/auth/gmail.send",
"https://www.googleapis.com/auth/script.send_mail"
],

I also checked in the AppScript Project -> Overview under "Project OAuth Scropes". The exact same scopes are present there.

I also added the exact same scopes in the OAuth Consent Screen of the corresponding GCP Project.

What else can I do?

[Edit]

so after I while I was checking the Scopes in the AppScript Project Overview again and for some reason there are now different. Especially one scope was automatically added which could be the problem:

https://mail.google.com/

Could it be that the source code was scanned and this scope was added automatically? How can I publish then?


Solution

  • I turns out that the issue was this scope https://mail.google.com/ which was automatically added. The reason was that I had the following line in the code which was actually not used anymore:

    GmailApp.getThreadById(event.threadId);

    So I removed it and it worked.