Usermeta data is not showing in auth0 application

hi! strange behaviour is giving by the auth0 i am trying to update user_metadata using actions in auth0 as

exports.onExecutePostLogin = async (event, api) => {
  api.idToken.setCustomClaim("email_address", event.user.email);
  api.idToken.setCustomClaim("app_metadata", event.user.app_metadata);
  
  const userMetadata = {
    ...event.user.user_metadata,
    id: 20,
    email: event.user.email
  };
  
  api.idToken.setCustomClaim("user_metadata", userMetadata);
};

it is updating the user_metadata and is showing in console that the user_metadata is updated.

image

But when i see in the auth0 dashboard management user > user> details it is showing as

1 Like

Hi @mmdanish,

This code does not update the user’s metadata in their profile.

To do that, you need to use the api.user.setUserMetadata method.

This explains how it works:

1 Like

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