Auth0: How to add custom properties to UserObject?

You can use an app_metadata property in the user object to store data that is not part of the normalized user profile. This would include a custom UUID like you described here.

The user object would look like this:

    client_id: "<ID of creating client (application)>",
    tenant: "<name of creating Auth0 tenant>",
    email: "<email address for the user>",
    password: "<password for the user>",
    username: "<name associated with the user>",
    user_metadata: {
        "language": "en"
    app_metadata: {
        "custom_id": "1234567890"

While user_metadata and app_metadata are optional, if supplied, they do not need to be stored in the legacy identity store; Auth0 automatically stores these values as part of the user profile record created internally. These values are (optionally) provided as a reference: their contents potentially being influential to legacy identity creation.

1 Like

Hello dan.woda thank you for your reply!
Would this be a proper way to solve the problem ‘on create’ (see picture)?
I mean it works but is it “dirty” or not?

And my other question would be how to get the app_metadata property from the user from the useAuth0 react hook. (
import {useAuth0 } from '@auth0/auth0-react';
const { user } = useAuth0();
My return object is this,


and it is definitely not the whole user object and it does not include the app_metadata property. Is there a way to extend this hook to get the additional app_metadat information? Or is another request with the user ID required to get the app_metadata information? :grin:

There are many ways to create unique IDs, whether it is time based or otherwise. See this stack overflow post.

The best way to do this is to add it to the ID token in a rule:

function(user, context, callback) {
  user.app_metadata = user.app_metadata || {};
  if(user.app_metadata.custom_id) {
    const namespace = '';
    context.idToken[namespace + 'custom_id'] = user.app_metadata.custom_id;
  callback(null, user, context);


Did you have a chance to take a look? Also, can you mark the stack overflow question solved if you get a chance :smile:

Yes @dan.woda , your answer helped me! I have now implemented it with Auth0 rules and it works! :slight_smile:

1 Like

Glad to hear it! Let us know if you have any other questions.

1 Like

Looks like it was deleted

I figured it out by myself, I did not define axios correctly what caused the error. :smiley:

1 Like

Thanks for posting an update. I marked it solved :slight_smile:

1 Like

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