title: Laravel Passport "auth:api" middleware acts as "web, auth" middleware
body: <p>I have set up the <strong>Laravel Passport</strong> package for Laravel 5.3 just as described in the official documentation (<a href="https://laravel.com/docs/5.3/passport#introduction" rel="noreferrer">https://laravel.com/docs/5.3/passport#introduction</a>).</p>
  
  <p>I want the API to be consumed by a mobile application, so I am trying to implement <strong>Password Grant Tokens</strong>. I have created a password grant client, and the token request process...</p>
  
  <pre><code>$response = $http-&gt;post('http://my-app.com/oauth/token', [
      'form_params' =&gt; [
          'grant_type' =&gt; 'password',
          'client_id' =&gt; 'client-id',
          'client_secret' =&gt; 'client-secret',
          'username' =&gt; 'my@email.com',
          'password' =&gt; 'my-password',
          'scope' =&gt; '',
      ],
  ]);
  </code></pre>
  
  <p>...Just works as expected, returning an <strong>access-token</strong> and a <strong>refresh-token</strong> for one of my users.</p>
  
  <p>On the one hand,</p>
  
  <pre><code>php artisan route:list
  </code></pre>
  
  <p>Lists correct middleware for api/user URI: <strong>api,auth:api</strong></p>
  
  <p>And driver for api guard is correctly set to <strong>passport</strong> in config/auth.php.
  Summing up, every step of the installation process has been done (<a href="https://laravel.com/docs/5.3/passport#installation" rel="noreferrer">https://laravel.com/docs/5.3/passport#installation</a>).</p>
  
  <p>Defaults contents of api.php:</p>
  
  <pre><code>Route::get('/user', function (Request $request) {
      return $request-&gt;user();
  })-&gt;middleware('auth:api');
  </code></pre>
  
  <p>The problem comes when I access to <a href="http://my-app.com/api/user" rel="noreferrer">http://my-app.com/api/user</a>, because it seems it is authenticating the request using the 'web' middleware, not the 'api'...
  When I access, I am redirected to /login (login form) if the user was not logged in, and to /home if it was...</p>
  
  <p>Any help would be really appreciated.
  Thanks in advance.</p>