The
nuxt-auto-crud stackprovides a dual-layer security model. The Core Engine handles low-level session/JWT verification and RBAC enforcement, while the Template Implementation manages OAuth2 flows and password lifecycle management.
The engine supports two primary authentication modes defined in nuxt.config.ts.
| Mode | Use Case | Requirements |
|---|---|---|
| Session | Fullstack Nuxt applications. | nuxt-auth-utils, nuxt-authorization. |
| JWT | Headless / API-only deployments. | NUXT_JWT_SECRET env variable. |
autoCrud: {
auth: {
type: 'session',
authentication: true, // Middleware user session check
authorization: true // Granular RBAC checks via nuxt-authorization
}
}
The reference template utilizes nuxt-auth-utils for seamless OAuth2 integration.
Configure identity providers in runtimeConfig.oauth:
NUXT_OAUTH_GITHUB_CLIENT_ID / _SECRETNUXT_OAUTH_GOOGLE_CLIENT_ID / _SECRETSecurity flows for password recovery are pre-integrated using Resend.
| Feature | Local Dev | Production |
|---|---|---|
| Capture | Logs to Server Console | Sends via Resend API |
| Storage | SQLite users table | SQLite users table |
| Token | Signed JWE/UUID | Signed JWE/UUID |
Ensure environment variables are set for email delivery:
NUXT_EMAIL_FROM=noreply@example.com
NUXT_RESEND_API_KEY=re_123456789
All API requests follow a strict sequential check:
action (create/read/etc) permission for this resource?action_own is assigned, does the createdBy ID match the current user?