@glinr/theauth-vue provides Vue 3 composables and an app plugin for building auth UIs. It works with Vite, Nuxt, and any Vue 3 setup.
Installation
Setup
Register the plugin in your Vue app:main.ts
Nuxt setup
In Nuxt, create a plugin file:plugins/theauth.client.ts
useSession
Returns the current session state. Reactive, updates when the user signs in or out.components/NavBar.vue
useUser
Returns the current user object, ornull if signed out.
useSignIn / useSignUp / useSignOut
pages/sign-in.vue
Sign up
Sign out
useAgents
Lists and manages agent identities for the current user.Plugin configuration reference
Refetch the session on window focus, reconnect or an interval. Off unless set. See Session refetch and SSR.
Use the core email and password routes (
/auth/email/sign-in, /auth/email/sign-up, body field email). Needs the emailPassword config on the server, see Email and password. signUp then resolves to data.verificationRequired, and the context also exposes verifyEmail, resendVerification, requestPasswordReset and resetPassword. Failed results carry the server code, for example EMAIL_NOT_VERIFIED.Route for
signIn (/auth/email/sign-in with emailPassword). The username routes are not served by createTheAuthHandler: forward them with theauth.username.handleRequest.Body field that carries the first argument of
signIn and signUp (email with emailPassword).GET {basePath}/auth/session. signOut clears local state first, then calls POST {basePath}/auth/sign-out to revoke the session on the server.
Related
Nuxt adapter
Server-side theAuth handler for Nuxt server routes and middleware.
Svelte
Svelte stores and SvelteKit hooks integration.
React
Hooks and provider component for React and Next.js apps.
Client SDK
Framework-agnostic fetch client underlying all framework SDKs.