Can't Migrate .NET SHA1 Passwords

Hello,

I am trying to migrate a user form a .NET app.
The password was created with the SHA1 algorithm.
Here is the JSON that I am sending

{
  "user_id": "id2",
  "email": "test2@email.com",
  "given_name": "ExampleCo User1",
  "name": "ExampleCoUser201",
  "custom_password_hash": {
    "algorithm": "sha1",
    "hash": {
      "value": "YZxddfit0uzjuxUf9huwthhkAMw=",
      "encoding": "base64"
    },
    "salt": {
      "value": "ux6wp1UbUbHFRbL+fDke+g==",
      "encoding": "base64"
    }
  }
}

The user gets transferred, but I can’t login with the supposed password. In my case the password is “123”

Is there something I am missing?

Adding some more info to this.
Just found out about the logs in auth0 and it seems like this requires the user to change its password.

{
  "error": {
    "message": "Password change required.",
    "reason": "Verification failed for the provided custom_password_hash: {'algorithm':'sha1','hash':{'value':'YZxddfi...','encoding':'base64'},'salt':{'value':'ux6wp1...','encoding':'base64'}}"
  }
}

Is it possible to skip this step and make the user to be able to log in with his password?

Ok, after 4 hours of digging and testing, I have finally found a solution to my problem.
I just had to add this line

"password":{
        "encoding": "ucs2"
      }

So the complete JSON looks like this

 {
    "user_id": "1111id2",
    "email": "nate@opd.com",
    "given_name": "ExampleCo User1",
    "name": "ExampleCoUser201",
    "email_verified": true,
    "custom_password_hash": {
      "algorithm": "sha1",
      "hash": {
        "value": "YZxddfit0uzjuxUf9huwthhkAMw=",
        "encoding": "base64"
      },
      "salt": {
        "value": "ux6wp1UbUbHFRbL+fDke+g==",
        "encoding": "base64"
      },
      "password":{
        "encoding": "ucs2"
      }
    }
  }

Hope it helps others with the same issue.

1 Like