Updating User Profile from Actions

I am wondering if anyone has had any success in updating the users profile from an action. In particular, I would like to use a URL based API to gather that information in the login process. I can get the data from the API, but it seems I can only find documentation on updating the user and app metadata. I would like to update the family_name and given_name of the profile.



Hi @igelu,

Welcome to the Auth0 Community!

I understand you have questions about updating the user’s profile family_name and given_name properties using Actions.

In this situation, I recommend using the Management API in Actions to call the updateUser() method and passing the family_name and given_name properties to be updated in the user profile. I have attached the corresponding code snippet below:

exports.onExecutePostLogin = async (event, api) => {

  const ManagementClient = require('auth0').ManagementClient;

  const management = new ManagementClient({
      domain: event.secrets.domain,
      clientId: event.secrets.clientId,
      clientSecret: event.secrets.clientSecret

  const params =  { id: event.user.user_id};

  const data = {
    "family_name" : "kenobi",
    "given_name" : "obiwan"

  try {
    const res = await management.updateUser(params, data) 
  } catch (e) {
    // Handle error

Moreover, I have tested this Action script and confirm that it will update the user’s family_name and given_name properties on their user profile.

I hope this helps!

Please let me know if there is anything else I can do to help.

Thank you.

1 Like