Enable verbose logging:
DEBUG=better-auth*
Check browser DevTools Network tab for /api/auth/* requests.
Yes, using database-less mode. Sessions are stored in encrypted cookies. This mode limits some features like session revocation.
No. This module requires Nuxt 3.10 or later.
Nuxt Better Auth uses the Better Auth library, which provides:
See the migration guide for detailed comparison.
Yes. Better Auth supports any database with a Drizzle, Prisma, or Kysely adapter. See Better Auth database documentation.
Configure in Better Auth, then augment types:
import { defineServerAuth } from '@onmax/nuxt-better-auth/config'
export default defineServerAuth({
user: {
additionalFields: {
role: { type: 'string', defaultValue: 'user' }
}
}
})
Use Better Auth's email plugin:
If using NuxtHub for database features, you need @nuxthub/core version 0.10.0 or higher. NuxtHub is optional - see NuxtHub Integration for details.
pnpm add @nuxthub/core@latest
The module validates config files at build time.
Create server/auth.config.ts exporting defineServerAuth(...).
The module expects a client config file at app/auth.config.ts exporting createAppAuthClient via defineClientAuth().
createServerAuth via defineServerAuth().secret/baseURL manually (the module injects these).server/auth.config.ts).Schema generation requires NuxtHub. Ensure NuxtHub is installed and DB is configured:
hub: { db: { dialect: 'sqlite' } }
Restart dev server after changing Better Auth plugins.
routeRules changes don't applyrouteRules are synced to page meta during pages:extend.
Restart dev server after updating route rules.
Only routeRules.auth is enforced for /api/**.
Use routeRules.auth (or call requireUserSession(event) inside handlers) to enforce access.