IDE/Maven 无法识别 Google API

fro*_*zen 3 java maven oauth-2.0 google-api-java-client

我正在使用 google API 进行 OAuth 令牌验证服务器端。进口产品为:

import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken;
import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken.Payload;
import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier;
Run Code Online (Sandbox Code Playgroud)

在我的 Mavenpom.xml依赖项部分:

    <dependency>
        <groupId>com.google.oauth-client</groupId>
        <artifactId>google-oauth-client</artifactId>
        <version>1.22.0</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

然而,我得到

无法解析符号“googleapis”

当我检查 中有哪些软件包时com.google.api.client,我也没有看到googleapis。然而,这些导入是直接取自此处的示例的

fro*_*zen 5

我想通了 - 我只需添加 Google API 客户端和 OAuth 客户端即可。这是依赖关系在pom.xml.

<!-- verify oauth tokens -->
        <dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.20.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.oauth-client</groupId>
            <artifactId>google-oauth-client</artifactId>
            <version>1.22.0</version>
        </dependency>
Run Code Online (Sandbox Code Playgroud)