# Can you access user app\_metadata from the front end with next.js?

**URL:** <https://community.auth0.com/t/can-you-access-user-app-metadata-from-the-front-end-with-next-js/81778>\
**Category:** Get Help\
**Tags:** nextjs, auth0, login\
**Created:** [April 14, 2022, 5:26pm UTC](https://community.auth0.com/t/can-you-access-user-app-metadata-from-the-front-end-with-next-js/81778 "2022-04-14T17:26:39Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [April 15, 2022, 5:14am UTC](https://community.auth0.com/t/can-you-access-user-app-metadata-from-the-front-end-with-next-js/81778/4 "2022-04-15T05:14:25Z")

</div>

Hey there @thekoala, bravo! 👏 👏 Thanks a bunch for sharing this with the community 🙂

I’ll add some color to this by sharing the following doc which outlines how metadata works in user profiles:

> **[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.

In addition to the Management API, you can also access user metadata via the [/user  
info](https://auth0.com/docs/api/authentication#get-user-info) endpoint (need the user’s access token), as well as via custom claims in the user id and/or access token. For example, here’s an action that will add both user\_metadata and app\_metadata to the user’s id token which can be extracted by your app post login:

```auto
exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://my-app.example.com';
  if (event.authorization) {
    api.idToken.setCustomClaim(`${namespace}/user_metadata`, event.user.user_metadata);
    api.idToken.setCustomClaim(`${namespace}/app_metadata`, event.client.metadata);
  }
};

```

Thanks again for your engagement with this, I’m sure it will be beneficial to other users 🤘

Cheers!

---

_[View the full topic](https://community.auth0.com/t/can-you-access-user-app-metadata-from-the-front-end-with-next-js/81778)._
