Authentication

Configure authentication for Nuxt Auto CRUD.

The module enables authentication by default. To test APIs without authentication, you can set auth: false.

Session Auth (Default)

Requires nuxt-auth-utils and nuxt-authorization.

export default defineNuxtConfig({
  autoCrud: {
    auth: {
      type: 'session',
      authentication: true, // Enables requireUserSession() check
      authorization: true // Enables authorize(model, action) check
    }
  }
})

JWT Auth

Useful for backend-only apps.

export default defineNuxtConfig({
  autoCrud: {
    auth: {
      type: 'jwt',
      authentication: true,
      jwtSecret: process.env.JWT_SECRET,
      authorization: true
    }
  }
})