Can Gmail API access a delegated user’s mailbox using the main account’s access token?

Hello,

We have a Gmail account (User A) that has delegated access to another Gmail mailbox (User B).

User A can view User B’s emails in the Gmail UI by switching to the delegated mailbox. We authenticate User A via OAuth and obtain an access token for User A.

Question:
Can we collect or access User B’s mailbox data using the Gmail API with User A’s access token, based solely on delegated access?

So far, API calls (e.g. users.messages.list) return only User A’s messages, not the delegated user’s data.

Is this expected behavior, or is there a supported way to access delegated mailbox data using the main account’s access token?

Thank you.

1 Like

My understanding - No, you cannot access User B’s mailbox using User A’s OAuth token.

Even though User A can see the emails in the web browser, Google treats the Gmail UI delegation and API access as two completely different beasts.

I created this issue in the issuetracker (473585688). I have the impression it’s the same problem i have. If so, maybe it’s good to upvote.