# Is there a way to access user management api from a post-password-change action?

**URL:** <https://community.auth0.com/t/is-there-a-way-to-access-user-management-api-from-a-post-password-change-action/66823>\
**Category:** Get Help\
**Created:** [July 26, 2021, 3:12pm UTC](https://community.auth0.com/t/is-there-a-way-to-access-user-management-api-from-a-post-password-change-action/66823 "2021-07-26T15:12:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![santiago](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/santiago/32/25293_2.png) [@santiago](https://community.auth0.com/u/santiago)\
**Post date:** [July 26, 2021, 3:12pm UTC](https://community.auth0.com/t/is-there-a-way-to-access-user-management-api-from-a-post-password-change-action/66823/1 "2021-07-26T15:12:48Z")

</div>

Is there a way to access user management api from a post-password-change action?

---

<div class="post-metadata">

**Author:** ![thameera](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/thameera/32/13430_2.png) [@thameera](https://community.auth0.com/u/thameera)\
**Post date:** [July 28, 2021, 9:32am UTC](https://community.auth0.com/t/is-there-a-way-to-access-user-management-api-from-a-post-password-change-action/66823/2 "2021-07-28T09:32:54Z")

</div>

Probably the easiest way to do this is to use the [Auth0 Node SDK](https://auth0.github.io/node-auth0/) in the action. Example:

```javascript
exports.onExecutePostChangePassword = async (event) => {
  const ManagementClient = require('auth0').ManagementClient
  
  const management = new ManagementClient({
    domain: 'REPLACE_WITH_TENANT_DOMAIN',
    clientId: event.secrets.MGMT_CLIENT_ID,
    clientSecret: event.secrets.MGMT_CLIENT_SECRET
  })

  // Example
  const res = await management.getUsersByEmail(event.user.email)
  console.log(res)
};

```

Make sure that you install the `auth0` npm module (from the Modules section), and set the two secrets (from the Secrets section).

---

<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:** [July 28, 2021, 10:30am UTC](https://community.auth0.com/t/is-there-a-way-to-access-user-management-api-from-a-post-password-change-action/66823/3 "2021-07-28T10:30:15Z")

</div>

Thanks for helping on this one @thameera !

---

<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:** [July 29, 2021, 8:36am UTC](https://community.auth0.com/t/is-there-a-way-to-access-user-management-api-from-a-post-password-change-action/66823/4 "2021-07-29T08:36:13Z")

</div>


