title: Laravel 9/Passport not working in production
body: <p>I just deployed a Laravel 9 Passport based API to Digital Ocean. Everything works fine, but when I try lo log an user or an admin and create a token to be stored and returned, I get 500 server error.</p>
  <p>I already ran <strong>php artisan passport:keys</strong>. Because it wasn´t working, I tried to pass the keys by .env through <strong>php artisan vendor:publish --tag=passport-config</strong>, but still got the error.
  Here is my LoginController:</p>
  <pre><code>public function login(Request $request)
  {
  
      $credentials = $request-&gt;only('email', 'password');
      
      if (!Auth::attempt($credentials)) {
          return response()-&gt;json([
              'message' =&gt; 'Usuario y/o contraseña inválidas'
          ], 401);
      }
  
          
          // If I comment this line and the accessToken in the json response, and return just the Auth::user(), it works fine
          $accessToken = Auth::user()-&gt;createToken('my_token')-&gt;accessToken;
      
      return response()-&gt;json([
          'user' =&gt; Auth::user(),
          'accessToken' =&gt; $accessToken
      ], 200);
  
      
  }
  </code></pre>
  <p>This is my AuthServiceProvider.php boot method:</p>
  <pre><code>public function boot()
  {
      $this-&gt;registerPolicies();
  
      
      
      /* Passport::routes(); */
      
      if (!$this-&gt;app-&gt;routesAreCached()) {
          Passport::routes();
      }
      /**
       * Controls the expire time for the access token
       */
  
  
      Passport::personalAccessTokensExpireIn(now()-&gt;addDays(30));
  
      Passport::tokensCan([
          'admin' =&gt; 'Admin',
          'user' =&gt; 'User',
      ]);
  }
  </code></pre>
  <p>No errors related are being logged neither in Laravel logs nor in nginx ones.
  Thanks for your help.</p>