【发布时间】:2017-05-30 21:25:54
【问题描述】:
我正在使用更新版本的 PubSub - Publisher API
我有一个 P12 文件,并且正在构建这样的凭据:
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(transport)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(serviceAccount)
.setServiceAccountScopes(Arrays.asList("https://www.googleapis.com/auth/pubsub"))
.setServiceAccountPrivateKeyFromP12File(new File(keyFile))
.build();
如何在 Publisher 上设置凭据?
另外,有没有办法获取静态范围字符串"https://www.googleapis.com/auth/pubsub"
【问题讨论】:
-
使用 Google 应用程序凭据更简单,如以下示例所示:github.com/GoogleCloudPlatform/google-cloud-java/blob/master/…。您无法使用该选项吗?您必须使用 P12 吗?