oauth-2.0google-apigoogle-email-settings-api

Using Email Settings API from app engine with service account


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?


Solution

  • 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