每次刷新页面时避免keycloak回调过程 [英] Avoid keycloak callback process every time when refreshing page

查看:283
本文介绍了每次刷新页面时避免keycloak回调过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的React应用程序中使用keycloak作为身份提供者.我已经使用npm在我的react应用程序中安装了keycloak react依赖关系.

I have used keycloak as a identity provider in my react application. I have installed keycloak react dependency in my react application using npm.

下面是版本为的依赖密钥库react npm模块:

Below are the dependent keycloak react npm modules with version :

"@ react-keycloak/web":"2.1.4",
" keycloak-js":"^ 11.0.2",

"@react-keycloak/web": "2.1.4",
"keycloak-js": "^11.0.2",

我提供了如下的密钥斗篷配置:

I have provided keycloak configurations as below :

const keycloak = new Keycloak({
  realm: "temp-local",
  url: " http://localhost:8090/auth/",
  clientId: "temp-local-client"
});

每次刷新页面时,它都会使用查询参数 state session_state code 再次刷新(带有回调URL).

Everytime when I refresh the page it will refresh again (with callback url) with query parameters state, session_state and code.

例如: 当我转到页面:http://localhost:8080/test时,它将转到那里,但再次刷新时,将使用以下URL刷新页面.

For example : When I go to the page : http://localhost:8080/test it will go there but again it will refresh the page with below url.

示例网址:http://localhost:8080/test#状态 = 45ert45-edac92ddbf2a& session_state = 45ga97bbfb4-f080cvb65e59b& 代码 = 1a1a-4e6e-3fg578-4fg10b-bbafg8-652fg6c44727a4

Sample url : http://localhost:8080/test#state=45ert45-edac92ddbf2a&session_state=45ga97bbfb4-f080cvb65e59b&code=1a1a-4e6e-3fg578-4fg10b-bbafg8-652fg6c44727a4

如何避免刷新密钥斗篷?谁能对此有任何想法?

How to avoid that keycloak refresh? Can anyone have any idea on this?

推荐答案

检查代码的其他部分是否在react-router中进行重定向: 我遇到了同样的问题,但是在大型代码库中,其他错误(由于缺少令牌)导致内部重定向到登录路由

Check if other parts of the code are doing redirects in react-router: I had the same problem, but in a large code base where other errors (because of lack of token) caused internal redirects to the login route

这篇关于每次刷新页面时避免keycloak回调过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆