Search code examples
gmail-apigoogle-schemas

access delegated mail folder with gmail api


let's say there are [email protected] and [email protected]. Alice has delegated her account to Bob. When I authenticate with Bob and try to list Alice inbox using the REST interface I get a 403 error:

[email protected] does not have privileges to [email protected] mailbox.

The URL used to query the inbox is:

www.googleapis.com/gmail/v1/users/[email protected]/messages

When I use [email protected] (or me) as userId there is no problem. How do I access Alice's account?

Greetings


Solution

  • You would need to get alice's consent and oauth token to access alice's account through the API--delegation is not supported like it is in the web interface.