Vue.js SDK for Asgardeo
# Using npm
npm install @asgardeo/vue
# or using pnpm
pnpm add @asgardeo/vue
# or using yarn
yarn add @asgardeo/vue
import { createApp } from 'vue'
import { AsgardeoAuth } from '@asgardeo/vue'
const app = createApp(App)
app.use(AsgardeoAuth, {
signInRedirectURL: "http://localhost:3000",
signOutRedirectURL: "http://localhost:3000",
clientID: "<your-client-id>",
baseUrl: "https://api.asgardeo.io/t/<org-name>",
scope: ["openid", "profile"]
})
app.mount('#app')
<template>
<div>
<div v-if="auth.isAuthenticated">
<p>Welcome, </p>
<button @click="auth.signOut">Sign Out</button>
</div>
<button v-else @click="auth.signIn">Sign In</button>
</div>
</template>
<script setup>
import { useAsgardeo } from '@asgardeo/vue'
const auth = useAsgardeo()
</script>
useAsgardeo()
: Main composable that provides:
isAuthenticated
: Boolean indicating authentication statususer
: Current user informationsignIn()
: Function to initiate sign insignOut()
: Function to sign outgetAccessToken()
: Function to get the current access tokengetBasicUserInfo()
: Function to get basic user informationuseAuthContext()
: Composable to access the raw authentication contextuseIsAuthenticated()
: Composable to check authentication statuspnpm install
pnpm build
pnpm test
pnpm dev
Apache License, Version 2.0 - see LICENSE for details.