1

このページで google-api-java-client を使用すると、いくつかのフローについて読むことができます。

サービス アカウント フローは、カレンダー API で正常に動作します。

GoogleCredential credential = new GoogleCredential.Builder().setTransport(HTTP_TRANSPORT)
                    .setJsonFactory(JSON_FACTORY)
                    .setServiceAccountId("[[]]")
                    .setServiceAccountScopes(CalendarScopes.CALENDAR)
                    .setServiceAccountPrivateKeyFromP12File(new File("key.p12")).build();

しかし、私たちは常に次のことを行っています。

503 Service Unavailable
{
  "code" : 503,
  "errors" : [ {
    "domain" : "global",
    "message" : "Backend Error",
    "reason" : "backendError"
  } ],
  "message" : "Backend Error"
}

使用する場合GroupssettingsScopes.APPS_GROUPS_SETTINGS(API コンソールは、このリクエストに対するアクセスを許可します)。

GApps アカウントのグループを管理するには、古い 2 脚の OAuth 1.0a に近いメカニズムを使用する必要があります。

よろしくお願いします

4

1 に答える 1

0

Groups Settings API では、Google Apps ユーザーになりすます必要があります。そして、そのユーザーは管理者である必要があります。

また、個人的に気になったのは、setServiceAccountId()メソッドにサービス アカウント ID を指定した方がよいということです。

これが私にとってうまくいくものです:

GoogleCredential credential = 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();
于 2014-05-17T15:02:26.410 に答える