Setup

Installation

Check the Nuxt.js documentation for more information about installing and using modules in Nuxt.js.

Add @nuxtjs/auth-next @nuxtjs/axios dependencies to your project:

yarn add --exact @nuxtjs/auth-next
yarn add @nuxtjs/axios
npm install --save-exact @nuxtjs/auth-next
npm install @nuxtjs/axios

Then, add @nuxtjs/auth-next to the modules section of nuxt.config.js:

nuxt.config.js
{
  modules: [
    '@nuxtjs/axios',
    '@nuxtjs/auth-next'
  ],
  auth: {
    // Options
  }
}

When adding auth-module to a new Nuxt project ensure you have activated the Vuex store. More information on how to do that can be found on the Nuxt Getting Started Guide.

Using with TypeScript

For more information about using TypeScript in your Nuxt.js project, visit the Nuxt Typescript documentation.

Add @nuxtjs/auth-next to the compilerOptions.types section of your project's tsconfig.json file:

tsconfig.json
{
  compilerOptions: {
    "types": [
      "@nuxtjs/auth-next",
    ]
  },
}

If you still receive errors after installing the types package, it may be necessary to restart your code editor so that the new types are recognized.

Edit this page on GitHub Updated at Thu, Feb 18, 2021