How to read user_metadata from user object?

Hello all. Maybe this is a beginner question but I’m really struggling to understand how can I read user_metadata after adding it from user management dashboard.

I am able to access default user_object properties such as family_name, nickname, name, etc, but not the ones I have added to the user_metadata field for each user.

What I would like to do is the following: after the login, the user has access to a profile page where he can see the default user object + user metadata. Then I would update user_metadata from the user management dashboard. Are there any tutorials or guides that can help me understand? Thank you very much.

I have this at the moment:

router.get('/', requiresAuth(), (req, res) => {

  res.render('pages/homepage', {
    title: 'some title',
    isAuthenticated: req.oidc.isAuthenticated(),
    user: req.oidc.user,
  });
});
```

Hi @figuitarrag,

Welcome to the Auth0 Community!

To get the user_metadata you will need to use the Management API v2 and call the Get a User endpoint.

You’ll also need to call the Management API using the Client Credentials flow.

Doing so will return the User Profile Attributes, including the user_metadata.

Please let me know you have any questions. I’d be happy to help.

Thank you.

Thank you very much. Best regards

1 Like

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