title: Laravel Passport: Use custom password
body: <p>I want to use <code>user_password</code> instead of just <code>password</code> for the name of the password column for the database of my API. So here is the code of the <code>login()</code> method to retrieve the token in my <code>PassportController</code>:</p>
  <pre><code>public function login() {
      if (Auth::attempt(['user_login' =&gt; request('login'), 'password' =&gt; request('user_password')])) {
          $user = Auth::user();
          $success['token'] = $user-&gt;createToken('ToutelaBreizh')-&gt;accessToken;
          return response()-&gt;json(['success' =&gt; $success], $this-&gt;successStatus);
      } else {
          return response()-&gt;json(['error' =&gt; 'Unauthorised.'], 401);
      }
  }
  </code></pre>
  <p>The parameters of the request to this controller are <code>login</code> and <code>password</code>.</p>
  <p>The problem is when I go to the route associated to this controller, let's say <code>POST /api/login</code>. I get this error:</p>
  <blockquote>
  <p>ErrorException: Undefined index: password in file ... EloquentUserProvider.php on line 133</p>
  <p>[First lines of the stack trace...]</p>
  <ol start="7">
  <li>... PassportController.php:21</li>
  </ol>
  </blockquote>
  <p>The 21st line in my PassportController is the second line of the login function I posted above and indeed, the <code>password</code> field is not informed in the credentials I wrote: I wrote <code>user_password</code> instead of <code>password</code>, but the string <code>password</code> is hard coded in the EloquentUserProvider.php, line 133:</p>
  <pre><code>public function validateCredentials(UserContract $user, array $credentials)
  {
      $plain = $credentials['password'];
  
      return $this-&gt;hasher-&gt;check($plain, $user-&gt;getAuthPassword());
  }
  </code></pre>
  <p>As suggested by <a href="https://stackoverflow.com/questions/40606818/laravel-passport-custom-password-column">this answer</a>, I tried to override the <code>validateForPassportPasswordGrant($password)</code> in the <code>User.php</code> model but it didn't help:</p>
  <pre><code>public function validateForPassportPasswordGrant($password)
  {
      return Hash::check($password, $this-&gt;user_password);
  }
  </code></pre>
  <p>How should I do to have <code>user_password</code> in my database and not <code>password</code>?</p>
  <p>Thank you for your help.</p>