Skip to content

Getting started

📦 Installation

Install @hebilicious/authjs-nuxt and auth.js @auth/core from npm :

bash
npx nuxi@latest module add authjs
npm i @auth/core
npx nuxi@latest module add authjs
npm i @auth/core

Import errors

You might run into imports errors for cookie or for the @auth/core internals. Uses aliases if you are running into import errors.

ts
import { resolve } from "node:path"

export default defineNuxtConfig({
  alias: {
    cookie: resolve(__dirname, "node_modules/cookie")
  }
})
import { resolve } from "node:path"

export default defineNuxtConfig({
  alias: {
    cookie: resolve(__dirname, "node_modules/cookie")
  }
})

pnpm

ts
export default defineNuxtConfig({
  alias: {
    cookie: "cookie"
  }
})
export default defineNuxtConfig({
  alias: {
    cookie: "cookie"
  }
})

Response support

Auth.js relies on native Response support, which is currently being added to Nuxt through h3 and nitro. Therefore you must use a recent version of Nuxt (3.6.5 or above).