Is there a way to extract additional attributes from the Keycloak object ? Currently,
If I try,
console.log(keycloak)
it will display the entire keycloak object. Even after reloading, it remains in the console.
However, when I do,
console.log(keycloak.token)
It only shows the token from the keycloak object but upon page reload, it returns undefined in the console.
This is my Vue Component:
<template>
<div class="home">
{{ arrowFunction() }}
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { useKeycloak } from "@baloise/vue-keycloak";
export default defineComponent({
name: "Home",
setup() {
const { keycloak } = useKeycloak();
function arrowFunction() {
console.log(keycloak);
return keycloak;
}
return {
arrowFunction,
};
},
});
</script>
This is my Main.ts:
import { vueKeycloak } from "@baloise/vue-keycloak";
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
const app = createApp(App);
app.use(vueKeycloak, {
initOptions: {
onLoad: "login-required", // default
},
config: {
url: "https://xxxxxxxxxxxxxx.com/auth/",
realm: "xxxxx",
clientId: "xxxxclient",
},
});
createApp(App).use(store).use(router).mount("#app");
The stored information can be found here: https://i.stack.imgur.com/x7IVE.jpg