1

ユーザー リストの取得は機能しますが、グループ リストはエラーを返します (access_denied)

ソース

scopeList.add(DirectoryScopes.ADMIN_DIRECTORY_USER);
scopeList.add(DirectoryScopes.ADMIN_DIRECTORY_GROUP);
scopeList.add(DirectoryScopes.ADMIN_DIRECTORY_GROUP_MEMBER);

credential = new GoogleCredential.Builder()
    .setTransport(httpTransport)
    .setJsonFactory(jsonFactory)
    .setServiceAccountId("xxxxx@developer.gserviceaccount.com")
    .setServiceAccountScopes(scopeList)
    .setServiceAccountPrivateKeyFromP12File(new java.io.File("xxxxx-privatekey.p12"))
    .setServiceAccountUser("admin@test.com")
    .build();

Directory admin = new Directory.Builder(httpTransport, jsonFactory, credential)
    .setApplicationName("Test")
    .setHttpRequestInitializer(credential).build();


admin.users().list().setDomain("test.com").execute();
admin.groups().list().setDomain("test.com").execute();

エラー

com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
{
  "error" : "access_denied"
}
    at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105)
    at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:332)
    at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:352)
    at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.executeRefreshToken(GoogleCredential.java:269)
    at com.google.api.client.auth.oauth2.Credential.refreshToken(Credential.java:454)
    at com.google.api.client.auth.oauth2.Credential.intercept(Credential.java:215)
    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:854)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
4

1 に答える 1

0
于 2013-08-25T13:16:57.403 に答える