title: Laravel Login to Admin dashboard redirect to 404 page after enable AuthenticateSession middleware
body: <p>Im working in simple blog site using laravel which has 2 parts , blog site for users and admin dashboard </p>
  
  <p>It is all works good before but after uncomment below line in Http/Kernal.php</p>
  
  <pre><code>\Illuminate\Session\Middleware\AuthenticateSession::class,
  </code></pre>
  
  <p>failed to login and redirect to admin dashboard and it is redirect to 404 page.</p>
  
  <p>I just want to use <code>AuthenticateSession</code> middleware because , i want to use 
  <strong>logoutOtherDevices</strong> function for website users          </p>
  
  <pre><code> Auth::logoutOtherDevices($request-&gt;input('new-password'));
  </code></pre>
  
  <p>when i comment out this line <code>\Illuminate\Session\Middleware\AuthenticateSession::class</code>, again it is working normal . </p>
  
  <p>please help me to solve this issue .</p>
  
  <p>I have <code>users</code> table used for login users and <code>admin</code> table for login admin to dashboard</p>
  
  <p>here is table for admin : </p>
  
  <p><a href="https://i.stack.imgur.com/yDcYr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yDcYr.png" alt="here is table for admin"></a> </p>
  
  <p>here is <code>config/auth.php</code> :</p>
  
  <pre><code>&lt;?php
  
  return [
  
      'defaults' =&gt; [
          'guard' =&gt; 'web',
          'passwords' =&gt; 'users',
      ],
  
  
  
      'guards' =&gt; [
          'web' =&gt; [
              'driver' =&gt; 'session',
              'provider' =&gt; 'users',
          ],
  
  
          'admin' =&gt; [
              'driver' =&gt; 'session',
              'provider' =&gt; 'admins',
          ],
  
  
  
      ],
  
  
  
      'providers' =&gt; [
          'users' =&gt; [
              'driver' =&gt; 'eloquent',
              'model' =&gt; App\Model\User::class,
          ],
  
          'admins' =&gt; [
              'driver' =&gt; 'eloquent',
              'model' =&gt; App\Model\Admin::class,
          ]
      ],
  
  
  
      'passwords' =&gt; [
          'users' =&gt; [
              'provider' =&gt; 'users',
              'table' =&gt; 'password_resets',
              'expire' =&gt; 60,
          ],
  
          'admins' =&gt; [
              'provider' =&gt; 'admins',
              'table' =&gt; 'password_resets',
              'expire' =&gt; 60,
          ]
      ],
  
  ];
  </code></pre>
  
  <p>here is admin login function : </p>
  
  <pre><code> public function login(Request $request)
      {
        // Validate the form data
        $this-&gt;validate($request, [
          'email'   =&gt; 'required|email',
          'password' =&gt; 'required|min:6'
        ]);
  
        if (Auth::guard('admin')-&gt;attempt(['email' =&gt; $request-&gt;email, 'password' =&gt; $request-&gt;password,'status'=&gt;1], $request-&gt;remember)) {
          // if successful, then redirect to their intended location
          return redirect()-&gt;intended(route('admin.dashboard'));
        }else{
          // if unsuccessful, then redirect back to the login with the form data
           return redirect()-&gt;back()-&gt;withInput($request-&gt;only('email', 'remember'));
        }
  
      }
  </code></pre>