java.io.IOException: 从流中读取凭证出错,'type'字段未指定。

问题描述 投票:0回答:1

我正试图用我自己的账号将一个java应用认证到google photos api中,根据文档,它不支持service_account。问题是google-console为OAuth2认证生成的文件不包含类型字段,只有为服务账户创建凭证生成的文件才能工作。

我尝试通过 gcloud auth application-default login 而不读取生成的文件,该文件中确实包含一个typeclient_idclient_secretrefresh_token。

E.G.。

        PhotosLibrarySettings settings =
                PhotosLibrarySettings.newBuilder()
                        .setCredentialsProvider(FixedCredentialsProvider.create(
                                GoogleCredentials.fromStream(
                                        new FileInputStream("credentials.json")
                                )))
                        .build();

任何想法,可能会有帮助?

google-authentication google-photos-api google-auth-library
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.