# Creating user with password via Management API

**URL:** <https://community.auth0.com/t/creating-user-with-password-via-management-api/91643>\
**Category:** Get Help\
**Tags:** auth0-php\
**Created:** [October 1, 2022, 9:28pm UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643 "2022-10-01T21:28:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![FuturShoc](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/futurshoc/32/40343_2.png) [@FuturShoc](https://community.auth0.com/u/FuturShoc)\
**Post date:** [October 1, 2022, 9:28pm UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643/1 "2022-10-01T21:28:46Z")

</div>

When I create a new user via the Management API, do I pass the password as a clear string or do I need to pre-encrypt it? ( bcrypt() ? )

I’ve assumed that it gets encrypted/hashed by the API…

Example:

$newUser = $management-\>users()-\>create(“Username-Password-Authentication”, [“email” =\> “[test@test.com](mailto:test@test.com)”, “password” =\> “somepassword”, “email\_verified” =\> true ] );

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [October 3, 2022, 1:09pm UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643/2 "2022-10-03T13:09:40Z")

</div>

Hi @FuturShoc

Cleartext string. The doc doesn’t explicitly state this, sorry.

John

---

<div class="post-metadata">

**Author:** ![FuturShoc](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/futurshoc/32/40343_2.png) [@FuturShoc](https://community.auth0.com/u/FuturShoc)\
**Post date:** [October 3, 2022, 3:50pm UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643/3 "2022-10-03T15:50:39Z")

</div>

Thank you! I’ve been trying that, but I suspect my test password doesn’t meet the complexity requirements…

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [October 4, 2022, 1:21pm UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643/4 "2022-10-04T13:21:38Z")

</div>

That should not matter - the password complexity rules are not checked in the mgmt API.

John

---

<div class="post-metadata">

**Author:** ![FuturShoc](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/futurshoc/32/40343_2.png) [@FuturShoc](https://community.auth0.com/u/FuturShoc)\
**Post date:** [October 4, 2022, 11:26pm UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643/5 "2022-10-04T23:26:45Z")

</div>

Are you sure about that?

 ![Screen Shot 2022-10-04 at 6.26.10 PM](https://global.discourse-cdn.com/auth0/original/3X/8/8/885a4db76495a6b9732a7e10d76cf7d682db7932.png)

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [October 5, 2022, 2:22pm UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643/6 "2022-10-05T14:22:08Z")

</div>

Interesting! I did not know that.

If you are using a lazy migration custom DB, the password rules are not enforced. That is what I was thinking of.

Did you get it working with a sufficiently strong password?

John

---

<div class="post-metadata">

**Author:** ![FuturShoc](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/futurshoc/32/40343_2.png) [@FuturShoc](https://community.auth0.com/u/FuturShoc)\
**Post date:** [October 6, 2022, 12:15am UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643/7 "2022-10-06T00:15:47Z")

</div>

Yes, that appears to do the trick. I was able to create a new user via the Management API (programmatically) and was able to log in with it. Thanks for your help.

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [October 6, 2022, 2:29pm UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643/8 "2022-10-06T14:29:05Z")

</div>

Excellent. I talked to a few experts yesterday, it turns out that the password strength rules are enforced almost everywhere EXCEPT the lazy migration case.

John

---

<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:** [October 20, 2022, 2:29pm UTC](https://community.auth0.com/t/creating-user-with-password-via-management-api/91643/9 "2022-10-20T14:29:43Z")

</div>

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