title: Laravel 7 Session store not set on request
body: <p>I'm trying to do a <strong>Custom Authentication with third-party authentication API</strong> which means I have a login endpoint in another project (Lumen Project). and I've found a tutorial about how to do it but using <code>Laravel 5.2</code> on <a href="https://www.minddevelopmentanddesign.com/blog/add-custom-api-authentication-to-laravel/" rel="nofollow noreferrer">here</a>.</p>
  
  <p>I'm using:</p>
  
  <ul>
  <li>Laravel 7</li>
  <li>PhpRedis/Redis</li>
  </ul>
  
  <p><strong>The ERROR:</strong></p>
  
  <blockquote>
    <p>RuntimeException: Session store not set on request.</p>
  </blockquote>
  
  <p>The tutorial is kinda simple. The steps follow as:</p>
  
  <ol>
  <li>Install PhpRedis and Guzzle.</li>
  <li>Create custom auth controllers which include <code>Throttles.php</code> where works the <strong>Cache</strong>.</li>
  <li>Override Laravel’s authentication middleware (<code>Authenticate.php</code>).</li>
  </ol>
  
  <p>I've done all the steps and I didn't miss anything. What I've tried to fix this but none of them works:</p>
  
  <ol>
  <li><p>I used the <code>web</code> middleware in the login routes but It won't work and I don't know why</p>
  
  <pre><code>Route::group(['middleware' =&gt; ['web']], function () {
      Route::get('login', 'Auth\CustomAuthController@showLoginForm');
      Route::post('login', 'Auth\CustomAuthController@login');
      Route::get('logout', 'Auth\CustomAuthController@logout');
  });
  </code></pre></li>
  </ol>
  
  <p>And you can see here my <code>Kernel.php</code> by default.</p>
  
  <pre><code>protected $middlewareGroups = [
          'web' =&gt; [
              \App\Http\Middleware\EncryptCookies::class,
              \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
              \Illuminate\Session\Middleware\StartSession::class,
              // \Illuminate\Session\Middleware\AuthenticateSession::class,
              \Illuminate\View\Middleware\ShareErrorsFromSession::class,
              \App\Http\Middleware\VerifyCsrfToken::class,
              \Illuminate\Routing\Middleware\SubstituteBindings::class,
          ],
  </code></pre>
  
  <ol start="2">
  <li>Configure the Cache driver</li>
  </ol>
  
  <p>My <code>.env</code> file</p>
  
  <pre><code>BROADCAST_DRIVER=log
  CACHE_DRIVER=redis
  QUEUE_CONNECTION=sync
  SESSION_DRIVER=redis
  SESSION_LIFETIME=120
  </code></pre>
  
  <p>My <code>database.php</code></p>
  
  <pre><code>'redis' =&gt; [
  
          'client' =&gt; env('REDIS_CLIENT', 'predis'),
  
          'options' =&gt; [
              'cluster' =&gt; env('REDIS_CLUSTER', 'redis'),
              'prefix' =&gt; env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
          ],
  
          'default' =&gt; [
              'host' =&gt; env('REDIS_HOST', 'localhost'),
              'password' =&gt; env('REDIS_PASSWORD', null),
              'port' =&gt; env('REDIS_PORT', 6379),
              'database' =&gt; 0,
              'read_write_timeout' =&gt; 60,
          ],
  
          'cache' =&gt; [
              'url' =&gt; env('REDIS_URL'),
              'host' =&gt; env('REDIS_HOST', '127.0.0.1'),
              'password' =&gt; env('REDIS_PASSWORD', null),
              'port' =&gt; env('REDIS_PORT', '6379'),
              'database' =&gt; env('REDIS_CACHE_DB', '1'),
          ],
  
          'session' =&gt; [
              'host' =&gt; env('REDIS_HOST', '127.0.0.1'),
              'password' =&gt; env('REDIS_PASSWORD', null),
              'port' =&gt; env('REDIS_PORT', 6379),
              'database' =&gt; 1,
          ],
  
      ],
  </code></pre>
  
  <p>And my <code>session.php</code></p>
  
  <pre><code>'connection' =&gt; 'session',
  </code></pre>
  
  <p>I've tried all that and none of these worked. I don't know what's happening, maybe Laravel 7 needs something else or I'm missing something. Just someone could know why the <code>web</code> middleware isn't working?</p>