updateAuthen
This commit is contained in:
parent
892b1d507c
commit
7e2350eef8
5 changed files with 99 additions and 57 deletions
39
src/main.ts
39
src/main.ts
|
|
@ -98,24 +98,27 @@ const kcToken = getCookie("BMAHRIS_KEYCLOAK_IDENTITY");
|
|||
const kcRefreshToken = getCookie("BMAHRIS_KEYCLOAK_REFRESH");
|
||||
|
||||
if (kcToken && kcRefreshToken) {
|
||||
keycloak
|
||||
.init({
|
||||
// onLoad: 'login-required',
|
||||
checkLoginIframe: false,
|
||||
token: kcToken,
|
||||
refreshToken: kcRefreshToken,
|
||||
})
|
||||
.then((authenticated) => {
|
||||
console.log("authenticated", authenticated);
|
||||
if (!authenticated) {
|
||||
window.location.reload();
|
||||
} else {
|
||||
console.log("Authenticated");
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error("Keycloak initialization failed:", err);
|
||||
});
|
||||
keycloak.init({
|
||||
// onLoad: 'login-required',
|
||||
checkLoginIframe: false,
|
||||
token: kcToken,
|
||||
refreshToken: kcRefreshToken,
|
||||
});
|
||||
keycloak.authenticated = true;
|
||||
|
||||
// .then((authenticated) => {
|
||||
// console.log("authenticated", authenticated);
|
||||
// if (!authenticated) {
|
||||
// window.location.reload();
|
||||
// } else {
|
||||
// console.log("Authenticated");
|
||||
// }
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// console.error("Keycloak initialization failed:", err);
|
||||
// });
|
||||
} else {
|
||||
keycloak.authenticated = false;
|
||||
}
|
||||
|
||||
app.mount("#app");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue