updated authen
This commit is contained in:
parent
9ec6a7696a
commit
c1f0ac7939
5 changed files with 39 additions and 28 deletions
38
src/main.ts
38
src/main.ts
|
|
@ -53,24 +53,26 @@ 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