Infinite refresh every 5 sec
See original GitHub issueI have a problem. In different browsers I can see page refresh every 5 sec. In some time keycloak.authenticated states is false. App is redirecting to login page where understanding that token is valid. I think that depends of browsers setting or plugins because I don’t have it before update Safari to new version. However, my colleague has that problem from starting project
`import Vue from ‘vue’; import App from ‘./App.vue’; import store from ‘./store’; import router from ‘./router’; import VueKeyCloak from ‘@dsb-norge/vue-keycloak-js’; import { initAxios, vuetify } from ‘./plugins’; import i18n from ‘./i18n’;
Vue.config.productionTip = false;
let keycloak = null;
Vue.use(VueKeyCloak, { config: { url: process.env.VUE_APP_KEYCLOAK_URL, realm: process.env.VUE_APP_KEYCLOAK_REALM, clientId: process.env.VUE_APP_KEYCLOAK_CLIENT_ID, }, init: { onLoad: ‘login-required’, }, onReady: kc => { keycloak = window.keycloak = kc; initKeycloak() .then(() => initAxios(kc.token)) .then(initApp) .catch(authenticate); }, });
function initApp() { new Vue({ store, router, vuetify, i18n, render: h => h(App), }).$mount(‘#app’); }
function initKeycloak() { return new Promise((resolve, reject) => { if (!keycloak.authenticated) reject(Error(‘401’)); else { protectRoutes(); resolve(); } }); }
function protectRoutes() { router.beforeEach((to, from, next) => { keycloak.authenticated ? next() : authenticate(); }); }
function authenticate() { if (keycloak.authenticated) return; window.location.replace(keycloak.createLoginUrl()); } `
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
I solved it Refresh there is when Third-Party Cookie were blocked.
Thx,@UncleVic And nlien,I figure out it,I check the vue-keycloak-js of doc and then view keycloak-js of doc,keycloak-js default 5s to refresh,So I setting checkLoginIframe:false for the configuration of man.js, To disable check login iframe, i still think to setting checkLoginIframe:true then it’s check you sso for you all system on you browse.