Updating User Metadata on Password Change Hook Completion

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";

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.

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.


Glad you have it figured out!

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