# Updating User Metadata on Password Change Hook Completion

**URL:** <https://community.auth0.com/t/updating-user-metadata-on-password-change-hook-completion/55139>\
**Category:** Get Help\
**Tags:** hooks\
**Created:** [December 20, 2020, 4:25am UTC](https://community.auth0.com/t/updating-user-metadata-on-password-change-hook-completion/55139 "2020-12-20T04:25:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kruegeba](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kruegeba/32/13314_2.png) [@kruegeba](https://community.auth0.com/u/kruegeba)\
**Post date:** [December 20, 2020, 4:25am UTC](https://community.auth0.com/t/updating-user-metadata-on-password-change-hook-completion/55139/1 "2020-12-20T04:25:38Z")

</div>

Am I able to edit a users metadata during a hook event (specifically change-password-hook)? I have the below and it does not seem to work at all? I am checking after I complete a forgot password/reset password flow…

```
module.exports = function (user, context, cb) {
// Perform any asynchronous actions, e.g. send notification to Slack.
user.user_metadata.force_password_reset = "false";
cb();
};

```

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [December 20, 2020, 8:18am UTC](https://community.auth0.com/t/updating-user-metadata-on-password-change-hook-completion/55139/2 "2020-12-20T08:18:00Z")

</div>

What you have there won’t work. Updating the `user` object inside the hook does not change the user’s profile in Auth0. I’m not sure whether you can do this at all from the change password hook, but if it is possible, I suspect you would need to use the Management API from within the hook to write your changes back to user profile.

---

<div class="post-metadata">

**Author:** ![kruegeba](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kruegeba/32/13314_2.png) [@kruegeba](https://community.auth0.com/u/kruegeba)\
**Post date:** [December 20, 2020, 2:18pm UTC](https://community.auth0.com/t/updating-user-metadata-on-password-change-hook-completion/55139/3 "2020-12-20T14:18:39Z")

</div>

Ah okay I guess I was confused about what the user object actually represented here. I ended up doing some logic with my backend API working with the Managment API.

---

<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:** [December 21, 2020, 10:12am UTC](https://community.auth0.com/t/updating-user-metadata-on-password-change-hook-completion/55139/4 "2020-12-21T10:12:32Z")

</div>

Glad you have it figured out!

---

<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:** [January 5, 2021, 10:12am UTC](https://community.auth0.com/t/updating-user-metadata-on-password-change-hook-completion/55139/5 "2021-01-05T10:12:33Z")

</div>

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