# How do I get User Metadata in the Login

**URL:** <https://community.auth0.com/t/how-do-i-get-user-metadata-in-the-login/71465>\
**Category:** Get Help\
**Created:** [October 17, 2021, 10:28pm UTC](https://community.auth0.com/t/how-do-i-get-user-metadata-in-the-login/71465 "2021-10-17T22:28:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![solid](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/solid/32/14106_2.png) [@solid](https://community.auth0.com/u/solid)\
**Post date:** [October 17, 2021, 10:28pm UTC](https://community.auth0.com/t/how-do-i-get-user-metadata-in-the-login/71465/1 "2021-10-17T22:28:12Z")

</div>

Please include the following information in your post:

- SDK Verion: express-openid-connect: “^2.5.1”,  
\*Platform Version: NodeJs 16.6.2

I am using nodejs and express openid connect and I am trying to get ALL of the user the metadata from auth0.

here’s the route:

```auto
const authenticationController = require("../controllers/auth.controller");
const { auth, requiresAuth } = require('express-openid-connect');

module.exports = function(app, cors, corsOptions) {
    app.get('/authentication', 
        cors(corsOptions),  
        requiresAuth(),
        function (req, res, next) {
            authenticationController.GetAuthentication( req, res, next );
    });
};

```

here’s the controller:

```auto
exports.GetAuthentication = async ( req, res, next ) => {
    try {
        var user = req.oidc.user;
        return res.status(200).json(user);
     } catch(err) {
       return next(err)
     }
  };

```

Here is the output:

```auto
{"nickname":"mynick"
,"name":"First Last",
"picture":"https://s.gravatar.com/avatar/xxx?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fso.png",
"updated_at":"2021-10-17T15:39:14.845Z",
"email":"user@domain.tld","email_verified":true,"sub":"auth0|123456xxx"}

```

As you can see none of the metadata for my user is showing up in the user object. How do I get the metadata?

---

<div class="post-metadata">

**Author:** ![Ale](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ale/32/50860_2.png) [@Ale](https://community.auth0.com/u/Ale)\
**Post date:** [October 18, 2021, 12:55am UTC](https://community.auth0.com/t/how-do-i-get-user-metadata-in-the-login/71465/2 "2021-10-18T00:55:29Z")

</div>

Hey @solid,

The reason you didn’t receive the user’s metadata is because metadata is not a standard claim so it will not be included in ID Tokens by default.

To include it, you must write a Rule to copy `user_metadata` properties to the ID token. This is explained in detail here: [Add custom claims to a token](https://auth0.com/docs/configure/apis/scopes/sample-use-cases-scopes-and-claims#add-custom-claims-to-a-token). I hope this helps.

More information:

> **[Understand How Metadata Works in User Profiles](https://auth0.com/docs/manage-users/user-accounts/metadata)**
>
> Describes Auth0 user, application, and client metadata. Learn how you can use metadata to store information that does not originate from an identity provider.

> **[Sample Use Cases: Scopes and Claims](https://auth0.com/docs/get-started/apis/scopes/sample-use-cases-scopes-and-claims)**
>
> Learn how to use scopes and claims with applications and APIs.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [October 18, 2021, 8:43am UTC](https://community.auth0.com/t/how-do-i-get-user-metadata-in-the-login/71465/3 "2021-10-18T08:43:07Z")

</div>

Thanks for helping on this one Ale!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [October 28, 2021, 12:24pm UTC](https://community.auth0.com/t/how-do-i-get-user-metadata-in-the-login/71465/4 "2021-10-28T12:24:18Z")

</div>


