'Delegation denied when try to send mail from another user's account - via api
In a browser, I can open my personal gmail account or I can open any delegated accounts by clicking the circle with my initial in and picking from the available delegates - no problem. Via API however, I can get an access token for my personal account and use this to send mail from my own account. If I try to send from the delegated account then I get the error.
So I have a token for my personal account eg [email protected] and post to https://gmail.googleapis.com/gmail/v1/users/**[email protected]**/drafts
because [email protected] has been delegated to by [email protected] I would expect the api call to work with my access token - in the same way as when I am signed in to my account in a browser then I can then open the delegator account without having to provide credentials again.
'{"error":{"code":403,"message":"Delegation denied for [email protected]","errors":[{"message":"Delegation denied for [email protected]","domain":"global","reason":"forbidden"}],"status":"PERMISSION_DENIED"}}'
Thanks for any help.
Solution 1:[1]
I think you are using a specific email address in the request. Maybe try by with userId="me".
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Fernando Lara |
