# Unauthorized for get data all users with api management

**URL:** <https://community.auth0.com/t/unauthorized-for-get-data-all-users-with-api-management/10547>\
**Category:** Get Help\
**Tags:** jwt, api, management-api\
**Created:** [April 2, 2018, 8:05am UTC](https://community.auth0.com/t/unauthorized-for-get-data-all-users-with-api-management/10547 "2018-04-02T08:05:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![med001](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@med001](https://community.auth0.com/u/med001)\
**Post date:** [April 2, 2018, 8:05am UTC](https://community.auth0.com/t/unauthorized-for-get-data-all-users-with-api-management/10547/1 "2018-04-02T08:05:12Z")

</div>

hello,  
I try get data all users with api management with function getAll .. I get jwt via API Explorer and expiration of this jwt is 86400 seconds (1 day ).. Now when I try use this function I get this errror :

```
resulted in a `401 Unauthorized` response:
{"statusCode":401,"error":"Unauthorized","message":"Expired token received for JSON Web Token validation","attributes":{ (truncated...)

```

My question is how to takes token automatically in each use API or when token is expired I get other token automatically

thanks for advanced

---

<div class="post-metadata">

**Author:** ![kimcodes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kimcodes/32/81052_2.png) [@kimcodes](https://community.auth0.com/u/kimcodes)\
**Post date:** [April 2, 2018, 4:39pm UTC](https://community.auth0.com/t/unauthorized-for-get-data-all-users-with-api-management/10547/3 "2018-04-02T16:39:05Z")

</div>

👋 @med001 there are some good steps on how to generate a token automatically for the management API here [Management API Access Tokens](https://auth0.com/docs/api/management/v2/tokens#automate-the-process). Can you give it a try and let us know if you have any issues?

---

<div class="post-metadata">

**Author:** ![med001](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@med001](https://community.auth0.com/u/med001)\
**Post date:** [April 3, 2018, 9:46am UTC](https://community.auth0.com/t/unauthorized-for-get-data-all-users-with-api-management/10547/4 "2018-04-03T09:46:50Z")

</div>

@kimcodes yes this is solution … thank you so much

---

<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 6, 2018, 12:43pm UTC](https://community.auth0.com/t/unauthorized-for-get-data-all-users-with-api-management/10547/6 "2018-04-06T12:43:07Z")

</div>

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