Auth0 Home Blog Docs

I'm not able to Add Persistent Attributes To The User


Hello, I’m trying to add a user data to my app delevloped with Angular 5.
I add the login with auth0. I’d like to add some infos when I login like company name.
I follow this link, but i’m not able…

I insert the data on user_metadata

I create a new rule clicking on “Add Persistent Attributes To The User” with the following code:

function (user, context, callback) {
  user.user_metadata = user.user_metadata || {};
  user.user_metadata.cocompanylor = || 'Error';
  context.idToken[''] =;

  auth0.users.updateUserMetadata(user.user_id, user.user_metadata)
        callback(null, user, context);

All works but I saw and I see the result if I print con console all the profile.
But I want to assign property Company to my local variable…
I tried this.profile.user_metadata but it doesn’t work
How can I do that?


You’re assigning the value of to a custom claim named so in order to access that value on the client application you would have to do something like:

var company = this.profile[""];


Hello, thanks for your reply!

But I still have problems… the function overwrite the value on user_metadata and company become Error.

also another question: how can i use var_name istead of a url like: ?