Body: <p>This doesn't work:</p>
  <pre><code>$user = User::find()-&gt;email(&quot;bob@example.com&quot;)-&gt;one();
  if ($user-&gt;authenticate(&quot;myClearTextPassword&quot;)) {
    // This is never true, so you never get here
  }
  </code></pre>
  <p>Is this method broken, or am I using it incorrectly?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-21T01:28:26.637Z
Comments.Text: What does `$user->authError` return after you call the authenticate method?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-21T05:57:33.627Z
Comments.Text: Thanks for taking a look @BradBell. I get `invalid_credentials`, even when the password is correct.
Comments.UserDisplayName: David Jones
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-23T20:32:40.307Z
Comments.Text: Is the user in a soft-deleted state? Or do you have https://craftcms.com/docs/3.x/config/config-settings.html#preventuserenumeration set to `true`?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-04-22T04:41:56.043Z
Comments.Text: @BradBell I can confirm that this is not working still in 3.7.38.  preventUserEnumeration has not been set and should be defaulted to false.
Comments.UserDisplayName: biko
Tags: <authentication>
Title: Does the authenticate method in the User class work?
ThreadText: # Does the authenticate method in the User class work?
  
  (Asked by: username_0 on 2020-12-18)
  
  This doesn't work:
  
  ```
  $user = User::find()->email("bob@example.com")->one();
  if ($user->authenticate("myClearTextPassword")) {
    // This is never true, so you never get here
  }
  
  ```
  
  Is this method broken, or am I using it incorrectly?
  
  **Tags:** authentication
  
  > **Comments:**
  > **username_1**: What does `$user->authError` return after you call the authenticate method?  
  > **username_0**: Thanks for taking a look @username_1. I get `invalid_credentials`, even when the password is correct.  
  > **username_1**: Is the user in a soft-deleted state? Or do you have https://craftcms.com/docs/3.x/config/config-settings.html#preventuserenumeration set to `true`?  
  > **username_2**: @username_1 I can confirm that this is not working still in 3.7.38.  preventUserEnumeration has not been set and should be defaulted to false.  
  
  ---
  
  ## 0 answers
  
  