Update user_metadata example from API docs not working

Hi @conner.linzy,

Thanks for reaching out to the Auth0 Community!

First, I have tested the Rule snippet and was able to get it to work. I can confirm the doc example works correctly without issues.

In this case, I recommend you check the user’s profile details to verify if the user.user_metadata.preferences has already been created. If so, you will want to delete the property and retry again.

As an alternative, there is also the option to use the Auth0 Post-Login Action to accomplish the same results. For example:

exports.onExecutePostLogin = async (event, api) => {
  if(!event.user.user_metadata.preferences){
    const preference = { "fontSize" : 12 }
    api.user.setUserMetadata("preferences", preference);
  }
};

Please let me know if you need any clarification or have further questions.

Thank you.