Error importing user with custom hash

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):

[
                '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?

The issue was in the wrong documentation where it states that the salt field should be under the hash field:

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

image

1 Like

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

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