gpt4 book ai didi

java - IDE/Maven 无法识别 Google API

转载 作者:行者123 更新时间:2023-11-30 02:27:38 24 4
gpt4 key购买 nike

我正在使用 Google API 进行 OAuth token 验证服务器端。进口是:

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;

在我的 Maven pom.xml 依赖项部分:

    <dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
<version>1.22.0</version>
</dependency>

但是,我得到

Cannot resolve symbol "googleapis"

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

最佳答案

我想通了 - 我只需添加 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>

关于java - IDE/Maven 无法识别 Google API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45227215/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com