title: Nuxt js middleware auth redirect authenticated user to login page
body: <p>I'm using <strong>@nuxt/auth</strong> package with version <strong>4.9.1</strong>.</p>
  <p>Everything works properly before the user closes their browser, The problem arises when the user closes the browser after logging in and comes back with an absolute URL like this <code>example.com/admin</code>.</p>
  <p>How this problem can be resolved?</p>
  <p><strong>middleware/admin.js</strong></p>
  <pre><code>export default function ({$auth, error}) {
    if ($auth.user.type === 'admin') {
      return error('404 Not Found!')
    }
  }
  </code></pre>
  <p><strong>pages/admin.index</strong></p>
  <pre><code>&lt;template&gt;
    &lt;div class=&quot;container&quot;&gt;
      {{ $auth.user.name || $auth.user.mobile_number }}
    &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
    export default {
      name      : &quot;admin&quot;,
      middleware: ['auth', 'admin'],
    }
  &lt;/script&gt;
  </code></pre>