Reputation: 2890
Just trying to add authentication to my NuxtJs 3 app folloging nuxt/auth
configuration docs, but still get an error during app start:
// 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
Upvotes: 8
Views: 16720
Reputation: 11
You can use this nuxt-auth module which is compatible with nuxt 3: https://nuxt.com/modules/nuxt-auth https://github.com/sidebase/nuxt-auth
Edit
Use https://www.npmjs.com/package/@workmate/nuxt-auth instead the nuxt-auth module from sidebase adds your secrets to your public runtime
Upvotes: 1
Reputation: 46642
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.
Upvotes: 12
Reputation: 411
At the time being, nuxt/auth
module is not supported by Nuxt3.
You can find the list of modules supported by Nuxt3 here https://nuxt.com/modules?version=3.x
Upvotes: 3