Why is the first and last name not showing correctly in the user database

Why is it that when users log in using an email and password, their first and last names do not properly enter in the first and last name fields in the Auth0 database? This data (first and last name) only shows in metadata, and their email is re-entered as their name.

This makes searching for users really hard. And considering that curating the login functionality is a core utility, this seems like a big thing to not work properly. And note if they log in with Google, the first and last name correctly show in the correct fields.

Hi @billyfanning3,

Welcome to the Auth0 Community!

That is by design. You can workaround this by asking the user to submit their first and last name during the sign up process. See this knowledge solution for more information.

Let me know if you have any questions.

Thanks,
Rueben

Hi Reuben! Thank you so much for responding. So we definitely collect this information during the signup process.

What am I missing? This whole situation is very surprising to me. Thank you - really appreciate you!

Billy

Hi @billyfanning3,

Thanks for replying.

Have you ensured these attributes are saved to other user’s root attributes?

For example:

var options = {
  additionalSignUpFields: [{
    name: "given_name",
    storage: "root"
  }]
};

Cheers,
Rueben

Shoot Reuben! I am not sure how I missed this response. I am sharing this with our dev now. I am not the technical guy, ha.

Thank you!

1 Like

Hey Reuben. This is how our additional fields are set up.

additionalSignUpFields: [
{
name: “given_name”,
placeholder: “Enter your name”,
validator: function(givenName) {
return {
valid: givenName.length > 0,
hint: “Your first name is required”
};
}
},
{
name: “family_name”,
placeholder: “Enter your surname”,
validator: function(familyName) {
return {
valid: familyName.length > 0,
hint: “Your last name is required”
};
}
}
]

Though when I add storage: ‘root’, the metadata no longer show. So, givenName and familyName no longer are recognised in metadata. All we need is that givenName and familyName are shown on the table when user’s sign up with email and password, just like it is when the sign up with social so then we can easily search them by name.

Hi @omer.xh1998,

Yes, that is normal. If you choose to store it as storage: "root" then it will be stored in the user’s root attribute and not in the user_metadata.

After doing so, you can directly request the user’s given_name and family_name.

Thanks,
Rueben

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