0

I'm finding conflicting information regarding using a OAuth 2.0 Service Account with Gmail. In theory, granting Gmail full read/write scope to a Service Account would mean that the application would have access to the email of all users of your Google Apps domain. Is it really possible to do this with a Service Account?

diazdeteran
  • 1,144
  • 1
  • 13
  • 25
  • 2
    It is possible. Now, what is your code and which is the error you are seeing? Try to help us help you. – AMS Oct 22 '15 at 07:07
  • Thanks. I wanted to confirm before attempting to use an assertion flow with a Service Account, i.e. without user intervention. I will give it a shot. This note "All users of a domain using a service account that has been whitelisted with the power to impersonate, can impersonate any user in the domain. For example, this is why Gmail accounts cannot be impersonated with service accounts." found at https://developers.google.com/doubleclick-advertisers/reporting/service_accounts was throwing me off. – diazdeteran Oct 22 '15 at 22:17
  • Take a look here: https://developers.google.com/gmail/api/v1/reference/users/messages/send. Once you obtain a service account credentials object impersonating an admin user you can use the above method to send a message from the account you want. Even more, as the From header is within the Message object you can send a message with a From that account has permission to send as. – AMS Oct 23 '15 at 08:14
  • Thanks! Please paste this into the answer so I can give you credit for it :) – diazdeteran Oct 23 '15 at 16:36

1 Answers1

0

Take a look here. Once you obtain a service account credentials object impersonating an admin user you can use the above method to send a message from the account you want.

Even more, as the From header is within the Message object you can send a message with a From that account has permission to send as.

AMS
  • 244
  • 6
  • 21