Skip to main content
@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, or null 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

string
default:"'/api/theauth'"
Base path where your theAuth handler is mounted.
RefetchOptions
Refetch the session on window focus, reconnect or an interval. Off unless set. See Session refetch and SSR.
HydrateInput | null
Session the server already resolved. Skips the first request.
boolean
default:"false"
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.
string
default:"'/auth/username/sign-in'"
Route for signIn (/auth/email/sign-in with emailPassword). The username routes are not served by createTheAuthHandler: forward them with theauth.username.handleRequest.
string
default:"'/auth/username/sign-up'"
Route for signUp (/auth/email/sign-up with emailPassword).
string
default:"'username'"
Body field that carries the first argument of signIn and signUp (email with emailPassword).
SessionStorageLike
Defaults to window.localStorage when the browser allows it.
On install the plugin shows a stored session at once, then confirms it with GET {basePath}/auth/session. signOut clears local state first, then calls POST {basePath}/auth/sign-out to revoke the session on the server.

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.
Last modified on October 19, 2026