# Error importing user with custom hash

**URL:** <https://community.auth0.com/t/error-importing-user-with-custom-hash/77768>\
**Category:** Get Help\
**Created:** [February 7, 2022, 2:27am UTC](https://community.auth0.com/t/error-importing-user-with-custom-hash/77768 "2022-02-07T02:27:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex.pravdin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alex.pravdin/32/14224_2.png) [@alex.pravdin](https://community.auth0.com/u/alex.pravdin)\
**Post date:** [February 7, 2022, 2:27am UTC](https://community.auth0.com/t/error-importing-user-with-custom-hash/77768/1 "2022-02-07T02:27:12Z")

</div>

I’m trying to import users using the `jobs/users-imports` endpoint. The issue is with the custom password hash.

The has data is the following:

- sha256 hash: 4796f074756c646e02da84277d68c9a9a4e954bf2d9824254a53c8059f614bb8 (hex)
- salt: tj9cH56SuUpEa076O2YeZNd59hba4kWY (raw utf8, appended in the beginning of the password)

I’m creating the following `custom_password_hash` field for the user (in PHP):

```auto
[
                'algorithm' => 'sha256',
                'hash' => [
                    'value' => $hash,
                    'encoding' => 'hex',
                    'salt' => [
                        'value' => $salt,
                        'encoding' => 'utf8',
                        'position' => 'prefix',
                    ],
                ],
            ]

```

But the import operation fails. Logs in the dashboard don’t have any details why it fails. If I remove the `salt` field at all, the import succeeds but the password doesn’t work obviously because no salt is imported.

What I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![alex.pravdin](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alex.pravdin/32/14224_2.png) [@alex.pravdin](https://community.auth0.com/u/alex.pravdin)\
**Post date:** [February 7, 2022, 3:46am UTC](https://community.auth0.com/t/error-importing-user-with-custom-hash/77768/2 "2022-02-07T03:46:34Z")

</div>

The issue was in the wrong [documentation](https://auth0.com/docs/manage-users/user-migration/bulk-user-import-database-schema-and-examples) where it states that the `salt` field should be under the `hash` field:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/8/28087c38c3827cff9f2afa94b0cb2dab9a7945f5.png)

But the schema and samples are correct and it should be on the same level with `hash`.

![image](https://global.discourse-cdn.com/auth0/original/3X/0/5/05ac7561afbf8bb2865ce5622f879c21f59540b2.png)

---

<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:** [February 7, 2022, 10:42am UTC](https://community.auth0.com/t/error-importing-user-with-custom-hash/77768/3 "2022-02-07T10:42:07Z")

</div>

Perfect! Thanks for spotting that, I’ll make sure to relay it to appropriate team!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 22, 2022, 10:43am UTC](https://community.auth0.com/t/error-importing-user-with-custom-hash/77768/4 "2022-02-22T10:43:08Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
