We created a user in the Import/Export extension. When I try to log in with my username and password, I get a “verification failed for the provided custom_password_hash” error. Is there a limit on the number of rounds supported for the sha512 algorithm, similarly to what’s mentioned here? Anything else it could be?
Python used to generate the JSON:
password = "$6$rounds=656000$.F62OVVCvG7f/Q.n$GKZL5NnA5M0ZderSL8ZOl3eI9kkG/j7MRllpZEoSenC3P8W3qIL9j85oB.ophFW9QnPgtc8fYpuRymYukx2KH." # Original hash from passlib
split = password.split("$")
rounds = split[2].split("=")[1]
# Convert salt to base64 since I saw that in auth0 message boards
# I tried it without doing this and I wasn't able to import the record
salt = split[3]
salt_bytes = salt.encode("ascii") # get the hash
salt_base64_bytes = base64.b64encode(salt_bytes)
salt_base64 = salt_base64_bytes.decode("ascii")
# Convert checksum to base64 since I saw that in auth0 message boards
# I tried it without doing this and I wasn't able to import the record
checksum = split[4]
password_bytes = checksum.encode("ascii") # get the hash
password_base64_bytes = base64.b64encode(password_bytes)
password_base64 = password_base64_bytes.decode("ascii")
payload = {
"email": user["email"],
"name": user["fullName"],
"blocked": bool(user["inactive"]),
"email_verified": False,
"app_metadata": {
"user_type": user["userType"],
},
"custom_password_hash": {
"algorithm": "sha512",
"hash": {
"value": password_base64,
"encoding": "base64",
},
"salt": {"value": salt_base64, "encoding": "base64"},
},
}
Resulting JSON:
[
{
"email": "my-email@my-email.com",
"name": "My Name",
"blocked": false,
"email_verified": true,
"app_metadata": { "user_type": "internal" },
"custom_password_hash": {
"algorithm": "sha512",
"hash": {
"value": "R0taTDVObkE1TTBaZGVyU0w4Wk9sM2VJOWtrRy9qY01SbGxwWkVvU2VuQzNQOFczcUlMOWo4NW9CLm9waEZXOVFuQmd0YzhmWXB1UnltWXVreDJLSC4=",
"encoding": "base64"
},
"salt": { "value": "LkY2Mk9WVkN2RzdmL1Eubg==", "encoding": "base64" }
}
}
]
Results in Monitor tool in dashboard when I try to log in:
"details": {
"error": {
"message": "Password change required.",
"reason": "Verification failed for the provided custom_password_hash: {'algorithm':'sha512','hash':{'value':'R0taTDVObkE1TTBaZGVyU0w4Wk9sM...','encoding':'base64'},'salt':{'value':'LkY2Mk...','encoding':'base64'}}"
}
},