Where to store the users name property

I’m really confused about the name property in Auth0.

For example if you POST to /api/v2/users you can add a name property.

But if you PATCH to /api/v2/users with a name in the payload you get the following error:

 {
     "statusCode": 400,
     "error": "Bad Request",
     "message": "Payload validation error: 'Additional properties not allowed: name (consider 
 storing them in app_metadata or user_metadata. See \"Users Metadata\" in 
 https://auth0.com/docs/api/v2/changes for more details)'.",
    "errorCode": "invalid_body"
}

So where does Auth0 wan’t me to store the name property? In the root or in user_metadata?

Hi there @alexab, I also have linked the documentation below that dives into how the name of the user is a part of the Normalized User Profile and wouldn’t be typically a part of the the direct user’s metadata.

Data normalization

Auth0 supports a wide variety of connections. Each connection may return a different set of attributes about the user, and each provider may use different names for the same attribute, such as surname , last name and family name . To handle the increased complexity this presents, Auth0 provides a Normalized User Profile. Auth0 returns a basic set of information using specific attribute names so programs can rely on using those same names to retrieve information such as user_id , name , nickname , and picture . If available, additional attributes such as given_name and family_name are also included in the Normalized User Profile.
User Profiles

I also have included a link below documentation that that allows you to patch a user via /api/v2/users/{id} . Please let me know if this helps you in your quest or if you have any additional questions. Thanks!
https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id

1 Like

Hi there @James.Morrison. Thanks for taking the time to link to the relevant documentation, but I still don’t understand the name property. Take for example a user created with the management API that only has a auth0 database collection (email and password). When I create the user I can specify a name, but I can’t update that name with a PATCH request? How do you explain that?

Hey @alexab!

I’m not aware of the reasoning behind the hood of this exact endpoint but as far as I thought about it, it may behave that way, in this specific name-related case due to security reasons. Those are my two cents. Will confirm it internally but for now that kinda makes sense for me.

1 Like

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