Commit 72f1dbaa authored by Lionel Morin's avatar Lionel Morin
Browse files

Merge branch 'keycloak_refresh' into 'develop'

handle keyclaok refresh token

See merge request !7
parents 6e2b7249 2ee83e23
......@@ -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