# New ManagementClient() refuses to refresh access token

**URL:** <https://community.auth0.com/t/new-managementclient-refuses-to-refresh-access-token/176057>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [January 29, 2025, 7:22pm UTC](https://community.auth0.com/t/new-managementclient-refuses-to-refresh-access-token/176057 "2025-01-29T19:22:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriel.mojica](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gabriel.mojica/32/61617_2.png) [@gabriel.mojica](https://community.auth0.com/u/gabriel.mojica)\
**Post date:** [January 29, 2025, 7:22pm UTC](https://community.auth0.com/t/new-managementclient-refuses-to-refresh-access-token/176057/1 "2025-01-29T19:22:39Z")

</div>

I’m running into an issue with my Next.js backend where when I call`new managementClient()` inside a route & then execute an action with it, it returns a message “Expired token received for JSON Web Token validation”. I’m getting the client with domain, clientid, & clientsecret as args & it did work up until today when I started getting this error and can’t get it to disappear.

My first thought was that the small function I created to basically reuse the management client if it already existed to reduce the number of api calls was causing it not be refreshed. However, even after removing that & creating a new management client for each request, that still didn’t fix the issue and I received the same error.

I’m not exactly sure how to fix this since I’ve followed all the docs provided by auth0 so besides going and creating a manual process to refresh the management api token via http request calls, I don’t know what the next step would be. It was my understanding that using nodejs library, clientid-clientsecret, & managementClient utility it would handle refreshes on its own.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 29, 2025, 11:28pm UTC](https://community.auth0.com/t/new-managementclient-refuses-to-refresh-access-token/176057/3 "2025-01-29T23:28:14Z")

</div>

Hi @gabriel.mojica,

According to the `“Expired token received for JSON Web Token validation”` error message, it’s indicating that the access token being used has expired.

I went ahead and checked your tenant logs and found numerous “successful exchange of Access Token for a Client Credentials Grant logs” (`seccft`) logs.

Additionally, I checked your API settings and found that you have the **Token Lifetime** set to 24 hours and the **Token Lifetime for Browser-based Flows** set to 2 hours. These settings look fine.

I suggest that you decode your access token to verify that you are using the newly issued access tokens after expiration. Then, ensure you issue a new access token if the previous token has expired. This way, you won’t go over the quota for issuing M2M tokens.

Let me know if you continue having issues.

Thanks,  
Rueben

---

<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 12, 2025, 11:28pm UTC](https://community.auth0.com/t/new-managementclient-refuses-to-refresh-access-token/176057/4 "2025-02-12T23:28:43Z")

</div>

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