title: Larvel passport auth_token not saved
body: <p>I am working on a Laravel site and I have been the LoginController. Although I obtain the auth_token at login - it doesn't allow me to call the user method - it claims the user is &quot;unauthetnicated&quot;</p>
  <p><a href="https://laravel.com/docs/7.x/passport" rel="nofollow noreferrer">https://laravel.com/docs/7.x/passport</a>
  <a href="https://laravel.com/docs/5.8/api-authentication" rel="nofollow noreferrer">https://laravel.com/docs/5.8/api-authentication</a></p>
  <p>I followed some documentation claiming that its unauthenticated because I need to group commands in the route?</p>
  <p>&quot;This is because we are not authenticated to access that route&quot;
  <a href="https://www.toptal.com/laravel/passport-tutorial-auth-user-access" rel="nofollow noreferrer">https://www.toptal.com/laravel/passport-tutorial-auth-user-access</a></p>
  <p>but then it throws an error with ['cors', 'json.response']?</p>
  <p>my route/api.php looks like this</p>
  <pre><code>&lt;?php
  
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\Route;
  
  /*
  |--------------------------------------------------------------------------
  | API Routes
  |--------------------------------------------------------------------------
  |
  | Here is where you can register API routes for your application. These
  | routes are loaded by the RouteServiceProvider within a group which
  | is assigned the &quot;api&quot; middleware group. Enjoy building your API!
  |
  */
  
  Route::middleware('auth:api')-&gt;get('/user', function (Request $request) {
      return $request-&gt;user();
  });
  
  
  Route::group(['middleware' =&gt; [/*'cors', 'json.response'*/]], function () {
  
      // public routes
  
      // get auth token, POST, /login
      Route::post('login', 'LoginController@login');
      Route::post('logout', 'LoginController@logout')-&gt;middleware('auth:api');
  });
  
  
  Route::middleware('auth:api')-&gt;group(function () {
      // our routes to be protected will go in here
  });
  </code></pre>
  <p>and my logincontroller is like this</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use App\User;
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\Hash;
  use Illuminate\Validation\ValidationException;
  
  class LoginController extends Controller
  {
      //
  
      function login(Request $request)
      {
          $request-&gt;validate([
              'email' =&gt; ['required', 'email'],
              'password' =&gt; ['required']
          ]);
  
          $user = User::where('email', $request-&gt;email)-&gt;first();
  
          //if user not found or the request password and user password does not match
          if(!$user || !Hash::check($request-&gt;password, $user-&gt;password)){
              throw ValidationException::withMessages([
                  'email' =&gt; ['The provided credentials are incorrect']
              ]);
          }
  
          return $user-&gt;createToken('Auth Token')-&gt;accessToken;
      }
  
      function logout(Request $request)
      {
          $request-&gt;user()-&gt;tokens()-&gt;delete();
      }
  
  
  }
  </code></pre>