Create user in Drupal 8 but password not working I tried to create user in Drupal8 using entity_create. The user is created just fine, but I can't login with the password unless I change it from the admin page.

$authData['name'] = 'testuser';
$authData['pass'] = 'testpass';
$authData['mail'] = 'sss@test.com';
$authData['status'] = 1;
$account = entity_create('user', $authData);


I also tried, the following code (obtained from drush)

$account-&gt;pass = 'testpass';
$account-&gt;save();


and also $account-&gt;setPassword

none of above works.
I try with you code, I not see any problem and work for me (drupal 8 beta7).

$authData['name'] = 'testuser';
$authData['pass'] = 'testpass';
$authData['mail'] = 'sss@test.com';
$authData['status'] = 1;
$account = entity_create('user', $authData);
$account-&gt;save();


Note that user and pass are different when you try to log in

user: testuser

pass: testpass

That drupal 8 version are you using?