We have a google corporate account and are already using the Groups Provisioning API to manage groups in our domain. We now need to tweak group settings via the "group settings api". Our java code acts as special admin user in our domain for all Group Provisioning API as it manages groups.
a) I am reading https://developers.google.com/google-apps/groups-settings/auth
b) "If your application has certain unusual authorization requirements, .... or domain-wide delegation of authority (2LO), then you cannot currently use OAuth 2.0 tokens. In such cases, you must instead use OAuth 1.0 tokens and an API key."
c) I read: https://developers.google.com/console/help/#generatingdevkeys and generated a new server key for this app
d) Now what? How do I use this with the v1-rev25-1.14.2-beta version of the google-api-services-groupssettings API and the "google-api-client" version 1.14.1-beta? The only options I see in any examples (which are only for oauth 2.0 mind you) are using this GoogleCredential object which is only centered around oauth 2.0, which according to (a) above, we can't use.
e) Given no examples or helpful info on using the API keys with this library, I decided to just try to wing it using an example for creating the Groupsettings object via oauth 2.0 and one of our special service accounts clientEmail and privatekey. In some respects I'm not sure why this would not work given that groups are not "user data" but seems like they should be able to be managed by this admin api account I am connecting with.
HttpTransport httpTransport = new NetHttpTransport();
JacksonFactory jsonFactory = new JacksonFactory();
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId("ourspecial_client_email@from.api.console")
.setServiceAccountScopes(GroupssettingsScopes.APPS_GROUPS_SETTINGS)
.setServiceAccountUser("my.special.admin.user@ourdomain.com")
.setServiceAccountPrivateKeyFromP12File(
new java.io.File("/path/to/privatekey"))
.build();
Groupssettings service = new Groupssettings.Builder(httpTransport, jsonFactory, null)
.setApplicationName("my API Integration")
.setHttpRequestInitializer(credential).build();
Groups groups= service.groups().get("someexistingtestgroup@mydomain.com").execute();
Groups group = new Groups();
group.setWhoCanJoin("ALL_IN_DOMAIN_CAN_JOIN");
service.groups().patch("someexistingtestgroup@mydomain.com", group).execute();
When the code above executes, (the patch() call) I get back this error: (I also tried "update()" same result. What does this message mean?? Is this related to auth? or is this some invalid call in the update/patch?
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Permission denied: Cannot hide from Groups directory.",
"reason" : "invalid"
} ],
ALSO side note: Your "help" page states "Google engineers monitor and answer against the tag google-groups-settings." when posting here for help, but stackoverflow requires us to have XXXXX points in order to use it! Great, so nobody will see this.