Course lesson

Write Action To Add Metadata To A New User Profile

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

Duration
4 min
Access
Free
Transcript
Retained from source evidence

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