Spring Security-Google OAuth 2.0-UnknownHostException www.googleapis.com

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

我已根据本教程实现了Google oauth登录:https://www.callicoder.com/spring-boot-security-oauth2-social-login-part-1/

[在本地运行应用程序时,它可以正常工作。但是,将其部署在GKE上后,我无法登录-流失败,并显示以下错误:

error: [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

来自OAuth2AccessTokenResponseClient

正如我之前说过的,当在localhost上运行时,它工作正常,我无法对其进行调试。该应用使用静态IP与Ingress一起部署。我最近已将该IP分配到我的域。域已在Google API中注册Authorised redirect URIs

spring-security oauth-2.0 google-kubernetes-engine spring-security-oauth2 google-oauth2
2个回答
0
投票

Google API使用OAuth 2.0协议进行身份验证和授权。 Google支持常见的OAuth 2.0方案,例如针对Web服务器,已安装和客户端应用程序的方案。请查看此link

我们可以针对obtaining OAuth 2.0访问令牌执行以下步骤。步骤1:产生程式码验证器和质询第2步:将请求发送到Google的OAuth 2.0服务器步骤3:Google提示使用者同意步骤4:处理OAuth 2.0服务器响应步骤5:将授权代码交换为刷新和访问令牌


0
投票

问题是kube-dns豆荚没有起床。我设置了一个可抢占式群集,并向其唯一的节点池添加了污点。这阻止了kube-dns的启动:

Normal   NotTriggerScaleUp  61s (x22798 over 2d18h)  cluster-autoscaler  pod didn't trigger scale-up (it wouldn't fit if a new node is added): 1 node(s) had taints that the pod didn't tolerate
Warning  FailedScheduling   44s (x141 over 26h)      default-scheduler   0/1 nodes are available: 1 node(s) had taints that the pod didn't tolerate.

删除污点主机名后解析

© www.soinside.com 2019 - 2024. All rights reserved.