Search code examples
gmail-addons

Scope needed for getAttachments?


In a Gmail Add-on, this line:

var attachments = message.getAttachments();

fails with a message Access denied: : Not allowed for full access to mail message.

The appscripts.json manifest file contains:

"oauthScopes": [
  "https://www.googleapis.com/auth/gmail.addons.execute",
  "https://www.googleapis.com/auth/gmail.addons.current.message.metadata",
  "https://www.googleapis.com/auth/gmail.addons.current.message.action",
  "https://www.googleapis.com/auth/script.external_request",
  "https://www.googleapis.com/auth/script.locale"
]

What else is needed? I've not found any mention of which scope is required for getAttachments.


Solution

  • You can include this "https://www.googleapis.com/auth/gmail.addons.current.message.readonly" and remove these 2:

    "https://www.googleapis.com/auth/gmail.addons.current.message.metadata", "https://www.googleapis.com/auth/gmail.addons.current.message.action"

    This works for me.