title: Nuxtjs Auth module not working in the middleware
body: <p>Hi I found an old question similar to mine with no answer on StackOverFlow : <a href="https://stackoverflow.com/questions/63968320/nuxtjs-auth-axios-not-sending-cookie">nuxtjs/auth axios not sending cookie</a></p>
  <p>Also here on GitHub, without a valid solution: <a href="https://github.com/nuxt-community/auth-module/issues/478" rel="noreferrer">https://github.com/nuxt-community/auth-module/issues/478</a></p>
  <p>So the problem is that if I call <code>$auth.loggedIn</code> in any page, it works like a charm but if I do it in my custom authentication middleware (or if I use the default <code>auth</code> middleware), it always return <code>false</code>.</p>
  <h2>my auth configuration in nuxt.config.js</h2>
  <pre class="lang-js prettyprint-override"><code>auth: {
      strategies: {
        local: {
          endpoints: {
            login: {
              url: '/rest-auth/login/',
              method: 'post',
              propertyName: 'key',
            },
            logout: { url: '/rest-auth/logout/', method: 'post' },
            user: {
              url: '/rest-auth/user/',
              method: 'get',
              propertyName: false,
            },
          },
          tokenType: 'Token',
          tokenName: 'Authorization',
        },
        redirect: {
          login: '/user_dashboard',
          home: '/',
        },
      },
    },
  </code></pre>
  <h2>my custom auth middleware</h2>
  <pre class="lang-js prettyprint-override"><code>export default async function ({ $auth, redirect }) {
    const user = await $auth.loggedIn
    console.log(user) // &lt;-- this always return false for some reason :(
    if (user) {
      // let the user see the page
    } else {
      // redirect to homepage
      redirect('/')
    }
  }
  </code></pre>
  <h1>EDIT:</h1>
  <p>As requested, this is my package.json:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;name&quot;: &quot;&lt;MY_APP_NAME&gt;&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;private&quot;: true,
    &quot;scripts&quot;: {
      &quot;dev&quot;: &quot;nuxt&quot;,
      &quot;build&quot;: &quot;nuxt build&quot;,
      &quot;start&quot;: &quot;nuxt start&quot;,
      &quot;generate&quot;: &quot;nuxt generate&quot;,
      &quot;lint:js&quot;: &quot;eslint --ext .js,.vue --ignore-path .gitignore .&quot;,
      &quot;lint:style&quot;: &quot;stylelint **/*.{vue,css} --ignore-path .gitignore&quot;,
      &quot;lint&quot;: &quot;npm run lint:js &amp;&amp; npm run lint:style&quot;,
      &quot;test&quot;: &quot;jest&quot;
    },
    &quot;lint-staged&quot;: {
      &quot;*.{js,vue}&quot;: &quot;eslint&quot;,
      &quot;*.{css,vue}&quot;: &quot;stylelint&quot;
    },
    &quot;husky&quot;: {
      &quot;hooks&quot;: {
        &quot;commit-msg&quot;: &quot;commitlint -E HUSKY_GIT_PARAMS&quot;,
        &quot;pre-commit&quot;: &quot;lint-staged&quot;
      }
    },
    &quot;dependencies&quot;: {
      &quot;@nuxt/content&quot;: &quot;^1.9.0&quot;,
      &quot;@nuxtjs/auth&quot;: &quot;^4.9.1&quot;,
      &quot;@nuxtjs/axios&quot;: &quot;^5.12.2&quot;,
      &quot;@nuxtjs/pwa&quot;: &quot;^3.0.2&quot;,
      &quot;cookie-universal-nuxt&quot;: &quot;^2.1.4&quot;,
      &quot;core-js&quot;: &quot;^3.6.5&quot;,
      &quot;nuxt&quot;: &quot;^2.14.7&quot;,
      &quot;nuxt-buefy&quot;: &quot;^0.4.3&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@commitlint/cli&quot;: &quot;^11.0.0&quot;,
      &quot;@commitlint/config-conventional&quot;: &quot;^11.0.0&quot;,
      &quot;@nuxtjs/eslint-config&quot;: &quot;^3.1.0&quot;,
      &quot;@nuxtjs/eslint-module&quot;: &quot;^3.0.0&quot;,
      &quot;@nuxtjs/style-resources&quot;: &quot;^1.0.0&quot;,
      &quot;@nuxtjs/stylelint-module&quot;: &quot;^4.0.0&quot;,
      &quot;@vue/test-utils&quot;: &quot;^1.1.0&quot;,
      &quot;babel-core&quot;: &quot;7.0.0-bridge.0&quot;,
      &quot;babel-eslint&quot;: &quot;^10.1.0&quot;,
      &quot;babel-jest&quot;: &quot;^26.5.0&quot;,
      &quot;eslint&quot;: &quot;^7.10.0&quot;,
      &quot;eslint-config-prettier&quot;: &quot;^6.12.0&quot;,
      &quot;eslint-plugin-nuxt&quot;: &quot;^1.0.0&quot;,
      &quot;eslint-plugin-prettier&quot;: &quot;^3.1.4&quot;,
      &quot;husky&quot;: &quot;^4.3.0&quot;,
      &quot;jest&quot;: &quot;^26.5.0&quot;,
      &quot;lint-staged&quot;: &quot;^10.4.0&quot;,
      &quot;node-sass&quot;: &quot;^4.14.1&quot;,
      &quot;prettier&quot;: &quot;^2.1.2&quot;,
      &quot;sass-loader&quot;: &quot;^10.0.3&quot;,
      &quot;stylelint&quot;: &quot;^13.7.2&quot;,
      &quot;stylelint-config-prettier&quot;: &quot;^8.0.2&quot;,
      &quot;stylelint-config-standard&quot;: &quot;^20.0.0&quot;,
      &quot;vue-jest&quot;: &quot;^3.0.4&quot;
    }
  }
  
  </code></pre>