# Bulk user import using bcrypt does not allow to login to Auth0 universal login

**URL:** <https://community.auth0.com/t/bulk-user-import-using-bcrypt-does-not-allow-to-login-to-auth0-universal-login/60937>\
**Category:** Get Help\
**Tags:** api, auth0\
**Created:** [April 12, 2021, 7:00am UTC](https://community.auth0.com/t/bulk-user-import-using-bcrypt-does-not-allow-to-login-to-auth0-universal-login/60937 "2021-04-12T07:00:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryan9](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ryan9/32/28726_2.png) [@ryan9](https://community.auth0.com/u/ryan9)\
**Post date:** [April 12, 2021, 7:00am UTC](https://community.auth0.com/t/bulk-user-import-using-bcrypt-does-not-allow-to-login-to-auth0-universal-login/60937/1 "2021-04-12T07:00:02Z")

</div>

I’m using this endpoint /api/v2/jobs/users-imports (Create import users job) for importing users and below is Json file.

After API call, users are created successfully but for some reason, I cannot log in to Auth0 universal login.

Original password is ‘migration1’.

2 to 3 weeks ago it worked using the salt for bcrypt and could log in to Auth0 but now I checked that bcrypt doesn’t allow salt property via manual. Allowing salt property for bcrypt has changed recently ? and if so then what should I do to provide salt for bcrypt. Currently just calling below API without salt does not allow to log in.

@@@@ user created but login fails : Username or Password incorrect error

```auto
[
  {
    "user_id": "381",
    "app_metadata": {
      "type": "object",
      "description": "Migrated data from ABC"
    },
    "username": "mike.migration",
    "user_metadata": {
      "username": "mike.migration",
      "email": "mike+migration@abc.com.au",
      "given_name": "Michael Jackson",
      "family_name": "Jackson",
      "description": "User Michael Jackson is migrated from ABC"
    },
    "email": "mike+migration@abc.com.au",
    "given_name": "Michae Jackson",
    "custom_password_hash": {
      "algorithm": "bcrypt",
      "hash": {
        "value": "$2a$10$bWMkmi.x9wjzkKSGmWC/FeBpmPFkCJlsJuwfuOLSD4g2jioNi.zu."
      },
    }
  },
  {
    "user_id": "382",
    "app_metadata": {
      "type": "object",
      "description": "Migrated data from ABC"
    },
    "username": "chris.migration",
    "user_metadata": {
      "username": "chris.migration",
      "email": "chris+migration@abc.com.au",
      "given_name": "Chris Migration",
      "family_name": "Migration",
      "description": "User Chris Migration is migrated from ABC"
    },
    "email": "chris+migration@abc.com.au",
    "given_name": "Chris Migration",
    "custom_password_hash": {
      "algorithm": "bcrypt",
      "hash": {
        "value": "$2a$10$Vawe/n0.iRr95GK2zSL3Be3Mt0ukNtn985lp3Fih4eRUd9CYee6gO"
      },
    }
  }
]

```

@@@@ “message”:“Additional properties not allowed: salt”  
But it worked 3 weeks ago as far as I remember.  
Json format is not the problem. moving one level up salt throws the same error.

```auto
[
  {
    "user_id": "381",
    "app_metadata": {
      "type": "object",
      "description": "Migrated data from ABC"
    },
    "username": "mike.migration",
    "user_metadata": {
      "username": "mike.migration",
      "email": "mike+migration@abc.com.au",
      "given_name": "Michael Jackson",
      "family_name": "Jackson",
      "description": "User Michael Jackson is migrated from ABC"
    },
    "email": "simone+migration@farmbot.com.au",
    "given_name": "Simone Barakat",
    "custom_password_hash": {
      "algorithm": "bcrypt",
      "hash": {
        "value": "$2a$10$bWMkmi.x9wjzkKSGmWC/FeBpmPFkCJlsJuwfuOLSD4g2jioNi.zu.",
        "salt": "TYGHRHFhy+9mLXlPoeyxAOo+P4k="
      }
    }
  },
  {
    "user_id": "382",
    "app_metadata": {
      "type": "object",
      "description": "Migrated data from ABC"
    },
    "username": "chris.migration",
    "user_metadata": {
      "username": "chris.migration",
      "email": "chris+migration@abc.com.au",
      "given_name": "Chris Migration",
      "family_name": "Migration",
      "description": "User Chris Migration is migrated from ABC"
    },
    "email": "chris+migration@abc.com.au",
    "given_name": "Chris Migration",
    "custom_password_hash": {
      "algorithm": "bcrypt",
      "hash": {
        "value": "$2a$10$Vawe/n0.iRr95GK2zSL3Be3Mt0ukNtn985lp3Fih4eRUd9CYee6gO",
        "salt": "jxIvZQUXSGNOvH0TXUjYxHGlOx4="
      }
    }
  }
]

```

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [April 12, 2021, 5:23pm UTC](https://community.auth0.com/t/bulk-user-import-using-bcrypt-does-not-allow-to-login-to-auth0-universal-login/60937/3 "2021-04-12T17:23:50Z")

</div>

Hi @ryan9,

Welcome to the Community!

[According to our docs](https://auth0.com/docs/users/bulk-user-import-database-schema-and-examples#bcrypt), importing a bcrypt hash does not allow for a `hash.salt` parameter.

I can’t find any reference to it being allowed in the past.

As a side note, you should pass `hash.salt.value` with the value of the salt if you are importing a salt with your hash.

```auto
"hash": {
  "value": "$2a...",
  "salt": {
    "value": "abcd..."
  }
}
```

---

<div class="post-metadata">

**Author:** ![ryan9](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ryan9/32/28726_2.png) [@ryan9](https://community.auth0.com/u/ryan9)\
**Post date:** [April 12, 2021, 6:57pm UTC](https://community.auth0.com/t/bulk-user-import-using-bcrypt-does-not-allow-to-login-to-auth0-universal-login/60937/4 "2021-04-12T18:57:08Z")

</div>

Thanks for the response but your solution still does not work.

It seems like bcrypt does not allow additional property “salt” according to the error message.

It throws an error. Please refer to the below error message and Json.

And bcrypt without salt, we cannot login to Auth0 universal login. By adding salt, we can log in to Auth0 Universal login. Password : Ryan1234

Using password\_hash and custom\_password\_hash without salt can create users but cannot login to Auth0 universal login. it throws username or password not correct error.

@@@@ Error message

```
[
   {
      "user":{
         "user_id":"397",
         "app_metadata":{
            "type":"object",
            "description":"Migrated data from LRS"
         },
         "username":"RyanKim3",
         "user_metadata":{
            "username":"RyanKim3",
            "email":"ryan+3@farmbot.com.au",
            "given_name":"Ryan Kim",
            "family_name":"Kim",
            "description":"User Ryan Kim is migrated from LRS"
         },
         "email":"ryan+3@farmbot.com.au",
         "given_name":"Ryan Kim",
         "custom_password_hash":{
            "algorithm":"bcrypt",
            "hash":{
               "value":" *****",
               "salt":{
                  "value":"LZVGiqhOKbLtR/dehzg/pyhIJWY="
               }
            }
         }
      },
      "errors":[
         {
            "code":"OBJECT_ADDITIONAL_PROPERTIES",
            "message":"Additional properties not allowed: salt",
            "path":"custom_password_hash.hash"
         }
      ]
   }
]

```

@@@@ Json

```
[
  {
    "user_id": "397",
    "app_metadata": {
      "type": "object",
      "description": "Migrated data from LRS"
    },
    "username": "RyanKim3",
    "user_metadata": {
      "username": "RyanKim3",
      "email": "ryan+3@farmbot.com.au",
      "given_name": "Ryan Kim",
      "family_name": "Kim",
      "description": "User Ryan Kim is migrated from LRS"
    },
    "email": "ryan+3@farmbot.com.au",
    "given_name": "Ryan Kim",
    "custom_password_hash": {
      "algorithm": "bcrypt",
      "hash": {
        "value": "$2a$10$wJq9nVrKdTt1wYGjcgKLieoQk9.w1AEhTYhkmAH4SaDaLaZwRuUw6",
        "salt": {
          "value": "LZVGiqhOKbLtR/dehzg/pyhIJWY="
        }
      }
    }
  }
]

```

---

<div class="post-metadata">

**Author:** ![ryan9](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ryan9/32/28726_2.png) [@ryan9](https://community.auth0.com/u/ryan9)\
**Post date:** [April 13, 2021, 6:01am UTC](https://community.auth0.com/t/bulk-user-import-using-bcrypt-does-not-allow-to-login-to-auth0-universal-login/60937/5 "2021-04-13T06:01:38Z")

</div>

Sorted out. The problem was password in payload was not valid. After passing valid one, it worked out perfectly without salt at all.

Password hashed with Bcrypt has all the information in itself so it does not need to have salt at all. That is why Auth0 bulk user import does not allow to pass additional property “salt”.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [April 13, 2021, 4:01pm UTC](https://community.auth0.com/t/bulk-user-import-using-bcrypt-does-not-allow-to-login-to-auth0-universal-login/60937/6 "2021-04-13T16:01:16Z")

</div>

Perfect, thanks for the update.

---

<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:** [April 28, 2021, 4:01pm UTC](https://community.auth0.com/t/bulk-user-import-using-bcrypt-does-not-allow-to-login-to-auth0-universal-login/60937/7 "2021-04-28T16:01:48Z")

</div>

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