java - How to use Service Accounts OAuth 2.0 flow with GroupsSettings-api -


We can read about some sisters using google-api-java-client.

Service accounts work fine with the flow calendar API:. GoogleCredential.creative = new GoogleCredential.Builder () setTransport (HTTP_TRANSPORT) .setJsonFactory (JSON_FACTORY) .setServiceAccountId ("[[]]") .setServiceAccountScopes (CalendarScopes.CALENDAR) .setServiceAccountPrivateKeyFromP12File (new file ("Key.p12"). Build ();

But we have always:

  503 service unavailable {"code": 503, "Errors": [{"domain": "global" We use  GroupssettingsScopes.APPS_GROUPS_SETTINGS : "message": "backend error", "cause" , / Code> (API console grant access for this request).  

We have to use a mechanism near the old 2-level OAuth 1.0A to manage a GApps account group.

> With Group Settings API, you must impersonate a Google Apps user. Many thanks in advance

In addition to this, I have observed personnally that it is better to assign service account IDs to setServiceAccountId () method.

What works for me here:. GoogleCredential.creative = new GoogleCredential.Builder () setTransport (New NetHttpTransport ()) .setJsonFactory (New GsonFactory ()) .setServiceAccountId ("516444413363- 4i0cvva2abc8a3t63bbq1a9rfqe42p70@developer.gserviceaccount.com"). SetServiceAccountScopes (Collections.singletonList ("https://www.googleapis.com/auth/apps.groups.settings")) .setServiceAccountUser ("admin@my.doma.in") .setServiceAccountPrivateKeyFromP12File (new file ("key.p12 ")). Build ();

Comments