# How to get APP\_METADATA from user while using @auth0/nextjs-auth0

**URL:** <https://community.auth0.com/t/how-to-get-app-metadata-from-user-while-using-auth0-nextjs-auth0/148721>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [October 6, 2024, 2:54pm UTC](https://community.auth0.com/t/how-to-get-app-metadata-from-user-while-using-auth0-nextjs-auth0/148721 "2024-10-06T14:54:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxime.julien.paquet](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/maxime.julien.paquet/32/60014_2.png) [@maxime.julien.paquet](https://community.auth0.com/u/maxime.julien.paquet)\
**Post date:** [October 6, 2024, 2:54pm UTC](https://community.auth0.com/t/how-to-get-app-metadata-from-user-while-using-auth0-nextjs-auth0/148721/1 "2024-10-06T14:54:30Z")

</div>

Ready to post? 🔍 First, try searching for your answer.  
i’m trying to get the APP\_METADATA from a logged-in user.

i know it’s not in the @auth0/nextjs-auth0 so from what i have read the safest way is to use the “Management API”.

my first API call to get a valid token from the “Management API” work well but when i try to get userinfo with the token. i receive “Request failed with status code 400”

> let token = {};  
> var axios = require(“axios”).default;  
> var options = {  
> method: “POST”,  
> url: “[https://TENANT/oauth/token](https://TENANT/oauth/token)”,  
> headers: { “content-type”: “application/x-www-form-urlencoded” },  
> data: new URLSearchParams({  
> grant\_type: “client\_credentials”,  
> client\_id: “CLIENTID”,  
> client\_secret: “CLIENTSECRET”,  
> audience: “[https://TENANT/api/v2/](https://TENANT/api/v2/)”,  
> }),  
> };  
> await axios  
> .request(options)  
> .then(function (response) {  
> console.log(response.data);  
> token = response.data.access\_token;  
> })  
> .catch(function (err) {  
> console.error(error);  
> });

> options = {  
> method: “GET”,  
> url: “[https://TENANT/api/v2/users](https://TENANT/api/v2/users)”,  
> headers: {  
> “content-type”: “application/json”,  
> Authorization: “Bearer ${token}”,  
> },  
> };
> 
> await axios  
> .request(options)  
> .then(function (response) {  
> console.log(response.data);  
> })  
> .catch(function (error) {  
> console.error(error);  
> });

did some of you have exemple of code i could try ?

Thanks

---

<div class="post-metadata">

**Author:** ![maxime.julien.paquet](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/maxime.julien.paquet/32/60014_2.png) [@maxime.julien.paquet](https://community.auth0.com/u/maxime.julien.paquet)\
**Post date:** [October 6, 2024, 4:50pm UTC](https://community.auth0.com/t/how-to-get-app-metadata-from-user-while-using-auth0-nextjs-auth0/148721/2 "2024-10-06T16:50:16Z")

</div>

for those who as the same problem. you need to configure the permissions.

Go to Auth0 Management API → Machine to Machine Applications → expend your API and grant permiossions

---

<div class="post-metadata">

**Author:** ![vlad.murarasu](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vlad.murarasu/32/72793_2.png) [@vlad.murarasu](https://community.auth0.com/u/vlad.murarasu)\
**Post date:** [April 4, 2025, 7:02pm UTC](https://community.auth0.com/t/how-to-get-app-metadata-from-user-while-using-auth0-nextjs-auth0/148721/3 "2025-04-04T19:02:21Z")

</div>

Hi @maxime.julien.paquet,

Welcome to the Auth0 Community!

This post might be of help:

> [@Can you access user app\_metadata from the front end with next.js?](https://community.auth0.com/t/can-you-access-user-app-metadata-from-the-front-end-with-next-js/81778/4):
>
> Hey there @thekoala, bravo! clap clap Thanks a bunch for sharing this with the community slight_smile I’ll add some color to this by sharing the following doc which outlines how metadata works in user profiles: 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 th…

If you have any other question feel free to reach out.

Have a good one,  
Vlad

---

<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:** [April 18, 2025, 7:18pm UTC](https://community.auth0.com/t/how-to-get-app-metadata-from-user-while-using-auth0-nextjs-auth0/148721/5 "2025-04-18T19:18:05Z")

</div>

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