I have a script that uses domain-wide delegation to 1) read a user’s email; 2) write some body text into a Sheet; 3) label that user’s email as processed.
With the scope gmail.readonly I was able to do 1 and 2. I added gmail.modify to create and modify the label.
I am getting an error (403) about insufficient scope.
I have added the following scopes to both the set-up auth script and in the console for the service account.
auth/gmail/labels
auth/gmail/modify
and auth/gmail/readonly
This is part of the execution log
``
Could not add label to message ID 1985f1a91c2b4999. API response: { "error": { "code": 403, "message": "Request had insufficient authentication scopes.", "errors": [ { "message": "Insufficient Permission", "domain": "global", "reason": "insufficientPermissions"
```
What scopes should I use to create and assign a label to an email.