Password change is required after importing bulk user

Hello,

I have a question.

I am not able to login after importing bulk users.

I checked log message and got a message about password change is required.

this is one of user data that I imported to auth0 database.

{
“email”: “test@gmail.com”,
“name”: “name”,
“user_metadata”: {
“default_lang”: “en”,
“phone”: “”,
“user_name”: “user_name”,
“user_type”: “”
},
“custom_password_hash”: {
“algorithm”: “md5”,
“hash”: {
“value”: “xxxxxxxxxxxxxxxx”,
“encoding”: “base64”
}
}
}

Hi @hyun.park ,

Thank you for reaching us.

I understand that you want to know why password change is required after importing bulk users.

Do you mind send me a test user’s password and password hash in the DM?

Thanks!

1 Like

Hi @hyun.park ,

I could not decode your hash value to match the password. Could you provide a screenshot of the error?

In addition, does this happen with all imported users? Can they log in after changing password?

BTW, I tried with bcrypt and it’s working fine. Below is my scripts. This could be an alternative solution if you want to bulk import users with password.

  {
        "name": "test@test.com",
        "email": "test@test.com",
        "user_metadata": {
            "hobby": "xxx"
        },
        "app_metadata": {
            "organization": "xxx"
        },
        "custom_password_hash": {
            "algorithm": "bcrypt",
            "hash": {
                "value": "xxxx"
            }
        }
    }

Hi @hyun.park ,

If you can DM me the details about how you generate the hash value using your password, I will look into this further.

Thanks.

I’m facing the same issue where password change is required. It’s happening for all my users. This is an example user with the original password “password”:
{
“email”: “bobtesting@dw.com”,
“email_verified”: true,
“custom_password_hash”: {
“algorithm”: “pbkdf2”,
“hash”: {
“value”: “$pbkdf2-sha256$i=150000,l=8$OUNDYTdwc2M$OGMxMTczY2QyYWYxOGIyOWM4ZTkxODJkNDcxZTE4MTNhZGM5NTljM2M3NDkwMjQzNzMwMmU1MDdkMjVmMzZiMA”,
“encoding”: “utf8”
}
}
}

Do you know why this is happening?

Hi @ray1 ,

Welcome to the Auth0 Community!

I tested your scripts by adding the password encoding field, and it works! Could you please give it a try?

[
	{
	"email": "bobtesting@dw.com",
	"email_verified": true,
	"custom_password_hash": {
		"algorithm": "pbkdf2",
		"hash": {
			"value": "$pbkdf2-sha256$i=150000,l=8$OUNDYTdwc2M$OGMxMTczY2QyYWYxOGIyOWM4ZTkxODJkNDcxZTE4MTNhZGM5NTljM2M3NDkwMjQzNzMwMmU1MDdkMjVmMzZiMA",
			"encoding": "utf8"
		},
	 	"password": {
	        "encoding": "binary"
	    }
	}
}
]

Hope this helps!

Hi @lihua.zhang, i tried importing what you pasted above and the migration is successful, but im still seeing the banner that says “password change is required” when i try and log in with “password”.

I also suspect that ive been using the wrong keylen, i think it should be 32, but im still facing the same issue even when i update that value.

Hi @ray1 ,

Could you please repeat this issue in the and DM me the HAR file and the screenshot? And is this repeatable in the Chrome incognito mode? Thanks!

Hi @ray1 ,

I tried with keylength 64 and it works. Here is my scripts.

[
    {
    "email": "bobtestingkk2@dw.com",
    "email_verified": true,
    "custom_password_hash": {
        "algorithm": "pbkdf2",
        "hash": {
            "value": "$pbkdf2-sha256$i=150000,l=64$OUNDYTdwc2M$OGMxMTczY2QyYWYxOGIyOWM4ZTkxODJkNDcxZTE4MTNhZGM5NTljM2M3NDkwMjQzNzMwMmU1MDdkMjVmMzZiMA",
            "encoding": "utf8"
        },
        "password": {
            "encoding": "binary"
        }
    }
}
]

Hope this change will work for you! Please DM me if any further queries. Thanks!

Hi, I actually figured out my own issue which was that i needed to convert the stored hex hash in my personal database to binary data with binascii.unhexlify, before then converting it to b64. This seemed to fix the problem for me. It works now, with a keylength of 32.

Thank you for your help regardless.

1 Like

Thank you @ray1 for sharing the updates with us! Glad to know that you resolve this issue! :+1: :clap:

1 Like