Commit 2ee83e23 authored by Matthieu Lamalle's avatar Matthieu Lamalle Committed by Lionel Morin
Browse files

handle keyclaok refresh token

parent 6e2b7249
......@@ -45,13 +45,22 @@ const app = (
);
keycloak.init({onLoad: 'login-required', token, refreshToken})
.then(authenticated => {
.success(authenticated => {
if (authenticated) {
store.getState().keycloak = keycloak;
updateLocalStorage();
keycloak.updateToken(10).error(() => keycloak.logout());
updateLocalStorage();
if(sessionStorage.getItem('kc_token') != null){
ReactDOM.render(app, document.getElementById('root'));
}
if(sessionStorage.getItem('kc_token') != null){
ReactDOM.render(app, document.getElementById('root'));
}
setInterval(() => {
keycloak.updateToken(10).error(() => keycloak.logout());
console.log("KEYCLOAK")
sessionStorage.setItem('kctoken', keycloak.token);
}, 10000);
} else {
keycloak.login();
}
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment