Auth0 Home Blog Docs

Cannot update user metadata in post-user-registration hook

hooks

#1

The below doesn’t save user_metadata:

/* @param {object} user.user_metadata - user metadata*/
module.exports = function (user, context, cb) {
  // Perform any asynchronous actions, e.g. send notification to Slack. 
  user.user_metadata = { "someinfo": "abcd" };
  cb();
};

#2

According to the docs the post-user registration hook is intended to:

implement custom actions that execute asynchronously from the Auth0 authentication process after a new user registers and is added to the database

If you want to customize the user metadata you should experiment with the pre-user registration hook which states that can be used to:

prevent user registration and add custom metadata to a newly-created user


#3