Authentication
Choose the Better Convex Nuxt auth API for state, operations, users, routes, and backend policy.
Authentication is optional. When enabled, Better Auth owns the session and Better Convex Nuxt coordinates the identity used by Convex.
Choose the layer
| Need | API |
|---|---|
| Current auth status and session user | useConvexAuth() |
| Sign in, sign up, sign out, refresh | useConvexAuth() |
| Canonical Better Auth user or app projection | useConvexUser(query, args) |
| Declarative auth-state rendering | Global auth components |
| Navigation redirect | definePageMeta({ convexAuth: true }) |
| Query identity policy | auth: 'required' | 'optional' | 'none' |
| Product access enforcement | Application-owned Convex functions |
| Additional Better Auth client plugins | defineConvexAuthClient() |
Enable or disable auth
Auth is enabled when convex.auth is omitted or an options object:
convex: {
auth: {
}
}Disable it with the boolean literal:
convex: {
auth: false
}A disabled build does not register Better Auth runtime plugins, proxy handlers, or route middleware. Auth composables remain auto-imported and return the documented disabled state.
Start here
- New setup: Better Auth setup
- Rendering state: Auth state and user
- Operations: Sign in and sign out
- Navigation: Route protection
- Security: Backend authorization
- Plugins: Better Auth plugins