【发布时间】:2022-11-14 12:01:26
【问题描述】:
在我不断尝试安全地创建和使用 Oauth 2 令牌的过程中,我现在尝试通过以下代码获取令牌:
private static String getAccessToken() throws IOException {
GoogleCredentials googleCredentials = GoogleCredentials
.fromStream(new FileInputStream("service-account.json"))
.createScoped(Arrays.asList(SCOPES));
googleCredentials.refreshAccessToken();
return googleCredentials.getAccessToken().getTokenValue();
}
但是,GoogleCredentials 没有解决。我需要向我的应用程序 gradle 文件添加什么依赖项来解决这个问题?
【问题讨论】:
标签: android firebase-cloud-messaging access-token android-security