duplicate namespace auth/ for the namespaced module auth

Faced the same issue today after an update. To resolve:

Move the auth.js logic to index.js and delete auth.js.

index.js:

export const getters = {
    authenticated(state) {
      return state.auth.loggedIn
    },

    user(state) {
      return state.auth.user
    }
  }

If you are using a user.js mixin revise it as follows:

import Vue from 'vue'
import {mapGetters} from 'vuex'

    const User = {
        install(Vue, options) {
            Vue.mixin({
                computed: {
                    ...mapGetters({
                        user: 'user',
                        authenticated: 'authenticated'
                    })
                }
            })
        }
    };

    Vue.use(User);

By default, Nuxt use auth namespace to reserve authentication information. If you also create a file auth.js in store directory then there will be conflict with default configuration.

The solution which provided by "Panos" is completely okay. But if you are really interested to create a new module to maintain auth info as like you, then you could create a file Auth.js instead of auth.js in store directory. Which won't conflict default namespace.

Then you could return auth information from nuxt auth module, like as below. Here i catch auth module's state using rootState

export const getters = {
authenticated(state, getters, rootState) {
 return rootState.auth.loggedIn;
},

user(state, getters, rootState) {
 return rootState.auth.user;
}
};

Also if you are using a user.js mixin revise it as follows:

import Vue from "vue";
import { mapGetters } from "vuex";

const User = {
  install(Vue, options) {
  Vue.mixin({
  computed: {
    ...mapGetters("Auth", {
      user: "user",
      authenticated: "authenticated"
    })
  }
});
}
};
Vue.use(User);

You probably have a file inside your store folder called "auth.js" and you did not explicitly set vuex.namespace option in your nuxt.config.js file.

From the documentation:

every .js file inside the store directory is transformed as a namespaced module (index being the root module).

So that means, "auth" becomes a namespace automatically.

The issue is "auth" is also the default Vuex store namespace for keeping state because "vuex.namespace" option in your nuxt.config.js file is "auth" by default if none is set explicitly. That is where the duplicate comes.

To solve this, change your store/auth.js to something different like store/authentication.js or change your vuex.namespace option in your nuxt.config.js file to something other than "auth" or else it will be used as default.