vue.jsauthenticationnuxt.jsnuxt3.jsnuxt-module

How to use nuxtjs/auth-next module with Nuxt3?


Just trying to add authentication to my NuxtJs 3 app folloging nuxt/auth configuration docs, but still get an error during app start:

enter image description here

// nuxt.config.js

export default defineNuxtConfig({
    auth: {
        // ...
    },
    modules: [
        // '@nuxtjs/axios',
        '@nuxtjs/auth-next'
    ],
})

Received same error for @nuxtjs/axios but I just commented it out since its official documentation indicates to switch to $fetch API.

Cannot figure out where the error is


Solution

  • nuxt-auth is not compatible with Nuxt3 as told here: https://github.com/nuxt-community/auth-module/issues/1805#issuecomment-1326287711

    It's on the official roadmap but still not done by the core team.

    You could google for a homemade solution online. Thanks to Nuxt3 composables and some logic, it is totally achievable without an official module.


    You can use that community one in the meantime, as confirmed here.