从KeyCloak到HTTPS,而不是Localhost上的http redirect。

问题描述 投票:0回答:1
I通过KeyCloak服务将其重定向到授权,保护了路线组件。 在本地我使用Vite和代理到API服务器。

I有后端的auth端点:http:// localhost:3000/api/v3/auth/request?development_mode = 1&redirect_to ='http:// localhost:3000/'

当我使用此端点时,它将我重定向到KeyCloak服务,在成功的授权后,我应该退还我。

link from keycloak:

https://keycloak.biacorp.ru/realms/aps/protocol/openid-connect/auth?client_id=aps-back-dev&response_type=code&redirect_uri=http://localhost:3000/api/v3/ auth/callback&scope = email&state =%7B%27Development_mode%27:%201,%20%27REDIRECT_TO%27:%20%27Http://aps-dev.biacorp.ru%27%7%7d&nonce=

但主要问题是协议。我在http上工作的本地主机,但Kecloak将我返回https:// localhost:3000

有错误 -

本网站无法提供安全的连接 Localhost发送了无效的响应。 err_ssl_protocol_error

PS:

我试图通过“ Vite-Plugin-Mkcert”在本地上使用HTTPS,但是在运行本地服务器后,我会遇到错误:'此页面无法正常工作 Localhost没有发送任何数据。 err_empty_response'

对我来说是如此凌乱,一个无法逃避的问题是谁是谁的问题或后端。 export const ProtectedRoute = ({ children }) => { const [cookies] = useCookies(['access_token']) const currentUrl = encodeURIComponent(window.location.href) if (!cookies.access_token) { window.location.href = `http://localhost:3000/api/v3/auth/request?redirect_to=${currentUrl}&development_mode=1` } return children }

the Switch localhost在HTTPS
上解决的问题
    
reactjs localhost keycloak
1个回答
0
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.