谷歌OAuth2与谷歌云存储Java

时间:2018-05-27 06:34:36

标签: java google-cloud-platform google-cloud-storage google-oauth2

我正在尝试使用Java应用程序对Google云端存储进行身份验证。我已经可以使用Google使用OAuth 2获取令牌。我试图研究,但似乎找不到任何答案。

解决

1 个答案:

答案 0 :(得分:0)

基本上我所要做的就是在Java类中添加范围而不是在JSON文件中。看着错误的地方。使用下面的代码段附加

/** OAuth 2.0 scopes. */
    private static final List<String> SCOPES = Arrays.asList(
            "https://www.googleapis.com/auth/userinfo.profile",
            "https://www.googleapis.com/auth/userinfo.email",
            "https://www.googleapis.com/auth/devstorage.full_control",
            "https://www.googleapis.com/auth/cloud-platform");