How to get custom attributes for the attributes from the custom database

We have a connection to our own mysql database for fetching users and other properties related to the user.

In the callback of the login we defined the user details as such :
callback(null, {
user_id: user.id.toString(),
email: user.email,
“user_metadata”: {
“language”: “en”
},
“metadata”: {
“plan”: “full”
}
});

While trying the login modal from the auth0 dashboard I can see these properties :

But I am not able to add these properties as user_metadata or app_metadata from the rules in the custom namespace. When I tried to console these properties it throws undefined. Also, i tried to directly set them as user_metadata but still couldn’t find it in the profile of the id token.

Hi @dhavalchheda, Welcome to the Auth0 Community!

Have you tried something like this below in the login function:
return callback(null, {
user_id: “78345983475934759”,
email: “s.c24@example.com”,
user_metadata: {
language: “en”
}
});
Quotes will not be required for user_metadata.

Let us know if that works @dhavalchheda!

Hi thank you for the replies. I found the right solution. Just had to disable the auth0 sync to avoid cache.

1 Like

Perfect! Glad to hear that!