# Can't Migrate .NET SHA1 Passwords

**URL:** <https://community.auth0.com/t/cant-migrate-net-sha1-passwords/109663>\
**Category:** Get Help\
**Tags:** user-password-management, user-management\
**Created:** [June 21, 2023, 8:35am UTC](https://community.auth0.com/t/cant-migrate-net-sha1-passwords/109663 "2023-06-21T08:35:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kvelichkow2](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@kvelichkow2](https://community.auth0.com/u/kvelichkow2)\
**Post date:** [June 21, 2023, 8:35am UTC](https://community.auth0.com/t/cant-migrate-net-sha1-passwords/109663/1 "2023-06-21T08:35:26Z")

</div>

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

```auto
{
  "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?

---

<div class="post-metadata">

**Author:** ![kvelichkow2](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@kvelichkow2](https://community.auth0.com/u/kvelichkow2)\
**Post date:** [June 21, 2023, 12:20pm UTC](https://community.auth0.com/t/cant-migrate-net-sha1-passwords/109663/3 "2023-06-21T12:20:51Z")

</div>

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.

```auto
{
  "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?

---

<div class="post-metadata">

**Author:** ![kvelichkow2](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@kvelichkow2](https://community.auth0.com/u/kvelichkow2)\
**Post date:** [June 21, 2023, 12:38pm UTC](https://community.auth0.com/t/cant-migrate-net-sha1-passwords/109663/4 "2023-06-21T12:38:02Z")

</div>

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

```auto
"password":{
        "encoding": "ucs2"
      }

```

So the complete JSON looks like this

```auto
 {
    "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.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 7, 2023, 9:13am UTC](https://community.auth0.com/t/cant-migrate-net-sha1-passwords/109663/5 "2023-07-07T09:13:33Z")

</div>


