I am attempting to bulk import users via the users import job API endpoint but cannot successfully log in with the provided password after successful import. Our underlying code base is using the Elixir Comeonein library version 2.6. The users’ password hashes are generated using Bcrypt with a cost of 12 rounds and base64 encoded. It appears the custom_password_hash
field does not allow the combination of bcrypt
for the algorithm and base64
for the string encoding (see docs).
Examples of our attempts:
[
{
"custom_password_hash": {
"algorithm": "bcrypt",
"hash": {
"value": "$2b$12$uyNzoPKSNtJKw0O9ddLrk.6fhRnUwIpfnpekf2PTFOJitVWsGdkHm"
}
},
"email": "l+20210315C@tbot.com",
"name": "l+20210315C"
}
]
The above results in the error message in the UI:
“YOU NEED TO UPDATE YOUR PASSWORD BECAUSE THIS IS THE FIRST TIME YOU ARE LOGGING IN, OR BECAUSE YOUR PASSWORD HAS EXPIRED.”
The logs include the failure message:
Verification failed for the provided custom_password_hash: {‘algorithm’:‘bcrypt’,‘hash’:{‘encoding’:‘utf8’,‘value’:‘$2b$12$uyNzoPKS…’},‘salt’:{‘value’:‘’}}
A payload that includes the encoding also fails but with a different message:
[
{
"custom_password_hash": {
"algorithm": "bcrypt",
"hash": {
"encoding": "base64",
"value": "$2b$12$.CmuHxBer7oUKltamlml2euiG8/nLM2OC9krf10UnFGhAaS1yI2LS"
}
},
"email": "l+20210315D@tbot.com",
"name": "l+20210315D"
}
]
The error from the job error_details endpoint:
[
{
"user": {
"custom_password_hash": {
"algorithm": "bcrypt",
"hash": {
"encoding": "base64",
"value": "*****"
}
},
"email": "l+20210315D@tbot.com",
"name": "l+20210315D"
},
"errors": [
{
"code": "ONE_OF_MISSING",
"message": "",
"path": "custom_password_hash"
}
]
}
]
I suspect the issue is simply that the bcrypt
algorithm requires utf8
.
Any suggestions for how I might get this working? Thanks.