Integrating with VueJS
Using @authaction/web-sdk
Section titled “Using @authaction/web-sdk”npm install @authaction/web-sdkimport { createApp } from "vue";import { createAuthAction } from "@authaction/web-sdk/vue";
const app = createApp(App);app.use( createAuthAction({ domain: "myapp.eu.authaction.com", clientId: "your-client-id", redirectUri: "http://localhost:5173/callback", }));app.mount("#app");<script setup>import { useAuthAction } from "@authaction/web-sdk/vue";const { state, loginWithRedirect, logout } = useAuthAction();</script>
<template> <button v-if="!state.isAuthenticated" @click="loginWithRedirect()">Login</button> <button v-else @click="logout()">Hello {{ state.user?.name }}</button></template>Full SDK reference: github.com/authaction/authaction-web-sdk