title: Laravel Passport no authentication
body: <p>I have some strange problems with my laravel app.
  I have created an authentication system with Passport, I have installed everything as needed but I can't authenticate the user. When I log in it's creating a token correctly and everything seems to work fine, but when I want to add authentication in postman, it's always &quot;Not Authenticated&quot;. This is happening with Laravel 8, I have copied everything from my Laravel 7 app and there is working pretty fine. I will provide you with some code.</p>
  <p>This is middleware that I created to check authentication:</p>
  <pre><code>public function handle(Request $request, Closure $next)
      {
          if(!Auth::id()){
              return response()-&gt;json(['response' =&gt; false, 'status' =&gt; 403, 'message' =&gt; 'Not Authenticated'], 403);
          } else {
              return $next($request);
          }
      }
  </code></pre>
  <p>Here is Kernel</p>
  <pre><code>class Kernel extends HttpKernel
  {
      /**
       * The application's global HTTP middleware stack.
       *
       * These middleware are run during every request to your application.
       *
       * @var array
       */
      protected $middleware = [
          // \App\Http\Middleware\TrustHosts::class,
          \App\Http\Middleware\TrustProxies::class,
          \Fruitcake\Cors\HandleCors::class,
          \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
          \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
          \App\Http\Middleware\TrimStrings::class,
          \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
          \App\Http\Middleware\UserSecurity::class,
      ];
  
      /**
       * The application's route middleware groups.
       *
       * @var array
       */
      protected $middlewareGroups = [
          'web' =&gt; [
              \App\Http\Middleware\EncryptCookies::class,
              \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
              \Illuminate\Session\Middleware\StartSession::class,
              \Illuminate\View\Middleware\ShareErrorsFromSession::class,
              \App\Http\Middleware\VerifyCsrfToken::class,
              \Illuminate\Routing\Middleware\SubstituteBindings::class,
          ],
  
          'api' =&gt; [
              'throttle:api',
              \Illuminate\Routing\Middleware\SubstituteBindings::class,
              \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
          ],
      ];
  
      /**
       * The application's route middleware.
       *
       * These middleware may be assigned to groups or used individually.
       *
       * @var array
       */
      protected $routeMiddleware = [
          'auth' =&gt; \App\Http\Middleware\Authenticate::class,
          'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
          'check.auth' =&gt; \App\Http\Middleware\UserAuth::class,
          'cache.headers' =&gt; \Illuminate\Http\Middleware\SetCacheHeaders::class,
          'can' =&gt; \Illuminate\Auth\Middleware\Authorize::class,
          'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
          'password.confirm' =&gt; \Illuminate\Auth\Middleware\RequirePassword::class,
          'signed' =&gt; \Illuminate\Routing\Middleware\ValidateSignature::class,
          'throttle' =&gt; \Illuminate\Routing\Middleware\ThrottleRequests::class,
          'verified' =&gt; \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
      ];
  }
  </code></pre>
  <p>And here is application.blade.php</p>
  <pre><code>&lt;html lang=&quot;en&quot;&gt;
    &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,initial-scale=1.0&quot;&gt;
      &lt;meta name=&quot;csrf-token&quot; content=&quot;{{ csrf_token() }}&quot;&gt;
      &lt;!-- &lt;link rel=&quot;icon&quot; href=&quot;&lt;%= BASE_URL %&gt;favicon.ico&quot;&gt; --&gt;
  
      &lt;title&gt;Vuexy  - Vuejs, HTML &amp; Laravel Admin Dashboard Template&lt;/title&gt;
      &lt;!-- Styles --&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;{{ asset(mix('css/main.css')) }}&quot;&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;{{ asset(mix('css/iconfont.css')) }}&quot;&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;{{ asset(mix('css/material-icons/material-icons.css')) }}&quot;&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;{{ asset(mix('css/vuesax.css')) }}&quot;&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;{{ asset(mix('css/prism-tomorrow.css')) }}&quot;&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;{{ asset(mix('css/app.css')) }}&quot;&gt;
      &lt;link
      rel=&quot;stylesheet&quot;
      href=&quot;https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css&quot;
    /&gt;
  
      &lt;!-- Favicon --&gt;
      &lt;link rel=&quot;shortcut icon&quot; href=&quot;{{ asset('images/logo/favicon.png') }}&quot;&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;noscript&gt;
        &lt;strong&gt;We're sorry but Vuexy  - Vuejs, HTML &amp; Laravel Admin Dashboard Template doesn't work properly without JavaScript enabled. Please enable it to continue.&lt;/strong&gt;
      &lt;/noscript&gt;
      &lt;div id=&quot;app&quot;&gt;
      &lt;/div&gt;
  
      &lt;!-- &lt;script src=&quot;js/app.js&quot;&gt;&lt;/script&gt; --&gt;
      &lt;script src=&quot;{{ asset(mix('js/app.js')) }}&quot;&gt;&lt;/script&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>And here is the Router:</p>
  <pre><code>Route::group(['middleware' =&gt; 'auth:api', 'middleware' =&gt; 'auth:api'], function() {
          Route::get('profile', [UserController::class, 'getUserDetails'])-&gt;name('profile');
          Route::post('logout', [UserController::class, 'destroySession'])-&gt;name('logout');
      });
  </code></pre>
  <p>Now what I have noticed is, when I use auth:API and not my middleware, I'm getting error like:</p>
  <pre><code>RuntimeException: Session store not set on request. in file C:\xampp\htdocs\sss\vendor\laravel\framework\src\Illuminate\Http\Request.php on line 483
  </code></pre>
  <p>Any ideas?</p>