Write Action To Add Metadata To A New User Profile

InstructorWill Johnson

Share this video with your friends

Send Tweet

Add a custom field to the users metadata with the Pre User Registration trigger.

In the Actions editor enter the following code

exports.onExecutePreUserRegistration = async (event, api) => {
  api.user.setUserMetadata("favorite_ninja_turtle","raphael" )
};

This action uses the API object to add the new metadata before the user is saved to the database

To learn more about Auth0 user metadata read the docs here