Auth0 Home Blog Docs

Auth0 additionalFields are not mapping in users profile's data

I have added three additional signup fields given_name, family_name, nickname in a lock with universal login page, but its not mapping correctly http://prntscr.com/opwer4 like given_name is not mapping as name. Its going in metadata
And also after signup when auth0 redirects back to the redirect url where can I receive the user metadata? Something like request[‘omniauth.auth’]

The additional signup fields always go into the metadata, regardless how you name them. You will need to assign them to the user’s standard claims via Rule and using the node-auth0 library in there (https://auth0.github.io/node-auth0/module-management.ManagementClient.html#updateUser).

I’ll try to provide some code snippet in a bit.

And also after signup when auth0 redirects back to the redirect url where can I receive the user metadata?

You need to add them to your ID token as a custom claim via Rule as well. See the example on:

Something like:

function (user, context, callback) {
  const namespace = 'https://my-namespace/';
  context.idToken[namespace + 'family_name'] = user.user_metadata.family_name;
  context.idToken[namespace + 'given_name'] = user.user_metadata.given_name;
  context.idToken[namespace + 'nickname'] = user.user_metadata.nickname;
  callback(null, user, context);
}

Then you’ll have them available in the ID token / user profile you get back in your client application. (Which technology stack are you using for your client?)

@mathiasconradt I’m using Ruby on Rails

@mathiasconradt solved thanks.

2 Likes

Glad you have it working!

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