updated authen with keycloak client

This commit is contained in:
Warunee Tamkoo 2024-07-23 14:46:40 +07:00
parent 93cf472aae
commit 9ec6a7696a
8 changed files with 378 additions and 32 deletions

View file

@ -37,6 +37,7 @@ app.component(
app.config.globalProperties.$http = http
// authen with keycloak client
function getCookie(name: string) {
const nameEQ = name + '='
const ca = document.cookie.split(';')
@ -61,9 +62,11 @@ if (kcToken && kcRefreshToken) {
})
.then((authenticated) => {
console.log('authenticated', authenticated)
// // // if (authenticated) {
// // // app.mount('#app')
// // // }
if (!authenticated) {
window.location.reload()
} else {
console.log('Authenticated')
}
})
.catch((err) => {
console.error('Keycloak initialization failed:', err)