Error importing users with custom password hash

Hello! I’m trying to import users using the new support for custom password hash. I followed the format of the docs and the examples there. Here is an example of an user I’m trying to import (fake data):

Input user
[
  {
    "custom_password_hash": {
      "hash": {
        "value": "$pbkdf2-sha1$i=10000, l=64$tM7Vr/ikmnhHUjimP8djWA==$1AAnQ+Q4nN+32165oPC1NXvQ/XTSQ7wFOIiqNh5Y5pg2W1CxPPz0JoE93c7zvHdHf5d1qZhQFe1pvNfCCxpqmQ=="
      },
      "algorithm": "pbkdf2"
    },
    "email_verified": true,
    "user_metadata": {
      "phone": "999999999"
    },
    "user_id": "b9eed9e5-2617-4a9c-b4dc-6cc9c9b5fefe",
    "given_name": "resseller",
    "family_name": "reseller",
    "email": "reseller_test@haulmer.com"
  }
]

When the job ends I get the following error

Error
"user": {
            "custom_password_hash": {
                "hash": {
                    "value": "*****"
                },
                "algorithm": "pbkdf2"
            },
            "email_verified": true,
            "user_metadata": {
                "phone": "999999999"
            },
            "user_id": "b9eed9e5-2617-4a9c-b4dc-6cc9c9b5fefe",
            "given_name": "resseller",
            "family_name": "reseller",
            "email": "reseller_test@haulmer.com"
        },
        "errors": [
            {
                "code": "ONE_OF_MISSING",
                "message": "",
                "path": "custom_password_hash"
            }
        ]

I’ve looked into the forums but there isn’t information about this error code.

Hi @reinaldo.jerez,

Welcome to the Community!

Importing pw hashes is a fairly new feature, please bear with me while I try and figure this out.

It looks like you may be missing "encoding": "utf8" in the hash object according to the doc:

HI @dan.woda, thanks for answering! I understand it is a new feature, killer feature IMO. I’ve already added the encoding and I get the same error.

Error including enc
{
        "user": {
            "custom_password_hash": {
                "hash": {
                    "encoding": "utf8",
                    "value": "*****"
                },
                "algorithm": "pbkdf2"
            },
            "email_verified": true,
            "user_metadata": {
                "phone": "999999999"
            },
            "user_id": "5ce70915-e6cd-4ae1-9106-b989f39c362c",
            "given_name": "resseller",
            "family_name": "reseller",
            "email": "clients_of_reseller@haulmer.com"
        },
        "errors": [
            {
                "code": "ONE_OF_MISSING",
                "message": "",
                "path": "custom_password_hash"
            }
        ]
    }

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

Hi There,

It looks like the generated password hash and salt in base64 encoding format. However, as far as the documentation, we support b64 encoding and it should be in PHC format. Can you try to remove padding character == from the salt and hash and import again. Thanks

1 Like