Password error in migrate users

I couldn’t migrate my mysql users, it says that the password is wrong, I generated the password with bcrypt at 10 rounds and nothing, I generate the password here and with C# I tried and the error persists, I have c#, with which library I generate the passwords to migrate the users

c# example
string passwordHash =BCrypt.Net.BCrypt.HashPassword(“XXXXX”,10);

1 Like

Hu @cangulor,

Welcome and thank you for posting in Auth0 Community! :wave:

Two other fields are not technically part of the user profile, but may be of interest when importing users:

  • password_hash (text): Hashed password for the user’s connection. When users are created, Auth0 uses bcrypt to secure the password. Importing compatible hashed passwords allows users to retain their passwords, thereby providing a smoother experience. Please note: compatible passwords should be hashed using bcrypt $2a$ or $2b$ and have 10 saltRounds.
  • password_set_date (date time): Timestamp indicating when the password for the user’s connection was set. At user creation, this field exists, and last_password_reset does not. If the user has reset their password, this field and last_password_reset are identical.

Can you make sure you are using password_hash instead of password ? schema example

If the user does not exist in Auth0 because of an invalid password error, the automatic migration does not upload them to the auth database with the login script?

How to perform the user migration, if the password will never be valid

function login(email, password, callback) {
  const mysql = require('mysql');
  const bcrypt = require('bcrypt');
	const connection = mysql.createConnection({
    host: configuration.server,
    user: configuration.uid,
    password: configuration.pwd,
    database: configuration.db


  const query = 'SELECT user_id, id, nickname, username, email, email_verified, given_name,family_name,name,picture, locale, password, zoneinfo FROM users WHERE email = ?';

  connection.query(query, [ email ], function(err, results) {
    if (err) return callback(err);
    if (results.length === 0) return callback(new WrongUsernameOrPasswordError(email));
    const user = results[0];   	
 , newHash, function(err, isValid) {
      if (err || !isValid) return callback(err || new WrongUsernameOrPasswordError(email));

      callback(null, {
        user_id: 'auth0|',
        nickname: user.nickname,
				email_verified: Boolean(user.email_verified),        
        locale: user.locale,
        given_name: user.given_name,
        family_name: user.family_name,
        phone_number: user.phone_number,
        phone_verified: Boolean(user.phone_verified),
        zoneinfo: user.zoneinfo

Was the user able to login at some point? If so, they do exists in Auth0. Have the user change their password:

If it existed at any time

I ran tests on an email I’ve never used before and it came up with the same error

Yes. I am also facing this issue since last week. Tried various solution, but no use.