# App Metadata (app\_metadata) not included in getIdTokenClaims() results

**URL:** <https://community.auth0.com/t/app-metadata-app-metadata-not-included-in-getidtokenclaims-results/127051>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [February 11, 2024, 2:22am UTC](https://community.auth0.com/t/app-metadata-app-metadata-not-included-in-getidtokenclaims-results/127051 "2024-02-11T02:22:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigp](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/craigp/32/45258_2.png) [@craigp](https://community.auth0.com/u/craigp)\
**Post date:** [February 11, 2024, 2:22am UTC](https://community.auth0.com/t/app-metadata-app-metadata-not-included-in-getidtokenclaims-results/127051/1 "2024-02-11T02:22:04Z")

</div>

- This code works in my DEV and QA tenants
- It is NOT working in my Production tenant

1. In the User’s profile, we set a custom field “fooId” in the App Metadata (app\_metadata) - see screen shot
2. When I invoke the `getIdTokenClaims()`, I only get the out of the box data, not my custom `fooId` value

```auto
import { useAuth0 } from "@auth0/auth0-react";
import axios from 'axios';
import Select from "react-select";

function OrgNew() {
    const { user, getIdTokenClaims } = useAuth0();
    const [fooId, setFooId] = useState();
    console.log(`OrgNew: init... :: user.fooId: <${user.fooId}>`);

    async function getAuthZeroClaims() {
        const claims = await getIdTokenClaims();
        console.log(`OrgNew: getAuthZeroClaims() :: claims: <${JSON.stringify(claims)}>`);
    }
    getAuthZeroClaims();
    
    useEffect(() => {
        if(user) {
            setFooId(user.fooId);
        }
        console.log(`OrgNew: useEffect() :: user:`, user);
        console.log(`OrgNew: useEffect() :: user.fooId: <${user.fooId}>`);
    },[user]);

```

![Screenshot 2024-02-10 at 6.17.34 PM](https://global.discourse-cdn.com/auth0/original/3X/5/f/5fde84883fad163ce3b4fbabbfb7f3089108b78a.png)

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [February 12, 2024, 9:44pm UTC](https://community.auth0.com/t/app-metadata-app-metadata-not-included-in-getidtokenclaims-results/127051/3 "2024-02-12T21:44:48Z")

</div>

Hey there @craigp welcome to the community!

> [@craigp](#):
>
> - This code works in my DEV and QA tenants
> - It is NOT working in my Production tenant

Is there any chance you have an [Action](https://auth0.com/docs/customize/actions) (or rule) configured to add the `app_metadata` as a custom claim in your DEV/QA tenants but not prod? The metadata won’t be included in token claims by default. An action to add this claim might look something like:

```auto
exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://example.com';
  api.idToken.setCustomClaim(`${namespace}/app_metadata`, event.user.app_metadata);
};
```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 26, 2024, 11:32pm UTC](https://community.auth0.com/t/app-metadata-app-metadata-not-included-in-getidtokenclaims-results/127051/4 "2024-02-26T23:32:10Z")

</div>

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