Using a service key: In the Gmail API, for example, I must impersonate the user to access their email. To access their calendar, however, I get an “error: unauthorized client” unless I remove the line impersonating the user. I then have to instead go to Calendar and share that calendar with the service account. Why? Surely, if I'm impersonating a user then they have access to their own calendars.
Asked
Active
Viewed 94 times
0
-
Are you sure that the scopes are properly authorized? At code, at the API project console and at the ManageOauthClients page in the Google Apps admin console. – AMS Jun 08 '16 at 08:03
-
@AMS During my tests I've been using my personal account, it's not a Google Apps account. This is going to be used at my work, where we do have an Apps account, but I was hoping it would work either way in case I use it in the future in a scenario without one. – Kenmore Jun 08 '16 at 17:21
-
I don't get how you use a Service Account to impresonate a personal account. Are you allowed to impersonate a personal account with no prompt (It's a Service Account, right?) ? To be clear: you can definitely impersonate a Google Apps account to access its calendar if given the authorization. – AMS Jun 09 '16 at 07:44
-
@AMS Well, I don't remember if I saw this documented somewhere or just figured out, but as far as I can tell you can 'impersonate' the account that created the service account, i.e., my personal account; in production it will be our company's primary account. – Kenmore Jun 10 '16 at 05:08