0

我正在尝试使用服务帐户的私有 .json 密钥获取凭据,它总是在这里抛出 GeneralSecurityException。

我在 android 上执行此操作,在阅读论坛后,您的项目中的 fromStream 和其他依赖项似乎存在问题(https://github.com/google/google-api-java-client/issues/979) -有人有什么建议吗?

InputStream credentialsJSON = context.getAssets().open("mykey.json");
JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
GoogleCredential credential = GoogleCredential.fromStream(credentialsJSON, httpTransport, JSON_FACTORY);
4

0 回答 0