Skip to main content

Authentication

Choose the Better Convex Nuxt auth API for state, operations, users, routes, and backend policy.

Authentication is optional. When you turn it on, Better Auth stores the session and Better Convex Nuxt signs the Convex client in as the same user.

Choose the API

NeedAPI
Current auth status and session useruseConvexAuth()
Sign in, sign up, sign out, pluginsuseConvexAuth().client
Application profile datauseConvexQuery(query, args)
Signed-in user in a Nitro handlergetConvexUser(event)
Require a signed-in user in NitrorequireConvexUser(event)
Signed-in user in a Convex functionauth.getUser(ctx), auth.requireUser(ctx)
Auth-state renderingVue conditionals
Navigation redirectdefinePageMeta({ convexAuth: true })
Query auth modeauth: 'required' | 'optional' | 'none'
Access checks on your dataYour Convex functions
Additional Better Auth client pluginsdefineConvexAuthClient()

Enable or disable auth

Auth is enabled only by an options object with one exact public origin:

ts
convex: {
  auth: {
    origin: process.env.SITE_URL ?? 'http://localhost:3000'
  }
}

Omit auth for a direct Convex-only application:

ts
convex: {
}

A no-auth build does not register Better Auth runtime plugins, proxy handlers, route middleware, auth auto-imports, or auth types. auth: false is reserved for a Nuxt configuration layer that must erase an inherited auth object.

Start here