1

I'm trying to use the Email Settings API from within a google marketplace app. Because I need all the logic to happen offline (in a cron job). I'm using an app engine Service Account, but when I'm trying to actually change the email settings for the users of the domain that installed it I'm getting this error:

You are not authorized to access this API.
Error 403

this is the scope: https://apps-apis.google.com/a/feeds/emailsettings/2.0/

I'm probably missing something, but I couldn't find the right docs to show me the way. How would I go about implementing an app that accesses the email settings even when the admin is offline?

MeLight
  • 5,454
  • 4
  • 43
  • 67
  • Um I don't think a service account has an email account. Even though its identified by an email address. You cant actually check its email. Why would you want to change its settings? – Linda Lawton - DaImTo Jun 17 '14 at 11:07
  • @DaImTo I don't want to change it's email settings (will update the phrasing in the question). I want to change the email settings of the users of the domain that installed the marketplace app. But I'm not sure what knd of credentials I should use to be able to achieve that – MeLight Jun 17 '14 at 11:22

2 Answers2

0

You need to set the prn attribute to address of an admin account.

Examples for the directory API are at:

https://developers.google.com/admin-sdk/directory/v1/guides/delegation#instantiate_an_admin_sdk_directory_service_object

Jay Lee
  • 13,415
  • 3
  • 28
  • 59
0

In terms of accessing the Email Settings API, you're really unlikely to get people to give you Service Account access to their domain.

On the other hand, if it's your domain (and thus you can add Service Account access), couple of pointers below:

What is important is that you add the following to the header:

"Authorization" = "Bearer <your_token>"

(note the very specific syntax - "Bearer+<1 space>+", as per https://www.rfc-editor.org/rfc/rfc6750 section 2.1)

"Content-Type" = "application/atom+xml"

(important for POST/PUT/DELETE requests, doesn't matter for GET)

that should get you up and running.

Community
  • 1
  • 1
Carpela
  • 2,155
  • 1
  • 24
  • 55