This commit is contained in:
ari
2025-11-21 14:43:08 +07:00
parent bbdaeee304
commit 9ce103f38e
9 changed files with 167 additions and 233 deletions
+24 -7
View File
@@ -1,13 +1,30 @@
<script setup lang="ts">
definePageMeta({
layout: 'blank',
public: true,
})
import { ref, onMounted } from 'vue'
import { useKeycloak } from "~/composables/useKeycloack"
const test = useRoute()
const temp = test.hash
const error = ref<string | null>(null)
const { initKeycloak, isAuthenticated, getResponse } = useKeycloak()
const profile = ref<any>(null)
const token = ref<string | null>(null);
onMounted(async () => {
try {
// Initialize Keycloak with login-required to ensure tokens set (Keycloak will process the code/state returned)
await initKeycloak('login-required')
// small delay to allow token propagation
if (isAuthenticated.value) {
await getResponse()
}
} catch (err: any) {
error.value = err?.message || String(err)
}
})
</script>
<template>
<span>success {{ temp }}</span>
<div style="max-width:720px;margin:40px auto">
<h2>Processing login...</h2>
<p v-if="error">Terjadi error: {{ error }}</p>
<p v-else>Mohon tunggu, sedang memproses otentikasi dan mengarahkan Anda ...</p>
</div>
</template>