Spring Oauth2 google login 抛出 UnknownHost Error.(version 5.1.X, and boot 2.1.2)

问题描述

我正在使用

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-client</artifactId>
    <version>5.1.13.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-oauth2-jose</artifactId>
    <version>5.1.13.RELEASE</version>
</dependency>

我没有使用最新版本,因为我的启动是 2.1.2.RELEASE我有几乎与 this blog(bealdung) 类似的架构,它今天可以使用。

我没有更改任何代码,但在向谷歌发送数据后突然打印如下错误。 (未知主机错误

[invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: I/O error on POST request for "https://www.googleapis.com/oauth2/v4/token": www.googleapis.com; nested exception is java.net.UnkNownHostException: www.googleapis.com

Error 的位置是 getTokenResponse 中的 org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizationCodeAuthenticationProvider.authenticate 语句。

据我检查,我设置的值(profile.yml 中的 client_idclient_secret)在 OAuth2AuthorizationRequest authorizationRequest 实例中。

我怀疑机密已过期,因此我在 Google Api 控制台中更新了我的机密,但还没有找到运气。我已经在这个问题上花了将近 3 个小时所以任何建议将不胜感激。

TLDR;

附注。 正如我所说,它以前有效,所以当然我在 Google Api 控制台中有正确的设置(uri 和授权的 uri,我的意思是)。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)