The @authdog/vue SDK adds browser authentication state to Vue 3 through a provider and composables. It also exposes low-level cookie/logout helpers for standard Web Request objects. It does not ship a Nuxt module or adapter.
Install
npm install @authdog/vueyarn add @authdog/vuepnpm add @authdog/vuebun add @authdog/vuedeno add npm:@authdog/vueRequires Vue ^3.5. The package ships three entry points: @authdog/vue (composables), @authdog/vue/client (provider), and @authdog/vue/server (SSR).
Wrap your app
Every composable reads from AuthdogProvider, so mount it at the root:
<script setup lang="ts">
import { AuthdogProvider } from "@authdog/vue/client"
</script>
<template>
<AuthdogProvider>
<YourApp />
</AuthdogProvider>
</template>On load the provider accepts a ?token= only when it has three JWT-shaped segments, stores it in localStorage, strips it from the URL, and reloads. This regex is not signature, issuer, audience, or expiry validation. fetchUser() validates usefulness by calling Authdog userinfo.
Composables
useUser()—{ user, isLoading, error, isAuthenticated, fetchUser(publicKey) }useSession()—{ session, isLoading }wheresessionis{ token, isAuthenticated }useSignIn()—{ signIn(publicKey, redirectUrl?), isLoading, error }useSignUp(),useSignOut()—{ signOut, isLoading, error }useOrganization(),useOrganizationList()— the caller's tenantsuseAuthz()—{ permissions, hasPermission, hasAnyPermission, hasAllPermissions, ... }
useUser().fetchUser(publicKey) and useSignIn().signIn(publicKey, ...) take your environment's public key (pk_...) explicitly:
<script setup lang="ts">
import { onMounted } from "vue"
import { useUser } from "@authdog/vue"
const { user, isLoading, fetchUser } = useUser()
onMounted(() => fetchUser(import.meta.env.VITE_AUTHDOG_PUBLIC_KEY))
</script>Server helpers
createAuthdogServer reads the raw authdog-session cookie and provides logout. It requires both keys, but currently has no server-side getUser method and does not validate the session:
import { createAuthdogServer } from "@authdog/vue/server"
const authdog = createAuthdogServer({
publicKey: process.env.AUTHDOG_PUBLIC_KEY!,
secretKey: process.env.AUTHDOG_SECRET_KEY!,
})
// authdog.getSession(request), authdog.logout(request)No cookie callback exchange is included. In Nuxt, build server integration explicitly: validate the bearer token with a backend SDK, set an HttpOnly cookie if needed, and enforce authorization in server routes. Treat provider/composable state and getSession() as untrusted input.
Next steps
- Sign up & sign in — the flows the provider drives.
- Backend requests — validate sessions on your API.
- Roles & permissions — the data behind
useAuthz.