# No payload for Access Token with @auth0/nextjs-auth0 version 4.4.2

**URL:** <https://community.auth0.com/t/no-payload-for-access-token-with-auth0-nextjs-auth0-version-4-4-2/185420>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [April 13, 2025, 5:46pm UTC](https://community.auth0.com/t/no-payload-for-access-token-with-auth0-nextjs-auth0-version-4-4-2/185420 "2025-04-13T17:46:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulr](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/paulr/32/60368_2.png) [@paulr](https://community.auth0.com/u/paulr)\
**Post date:** [April 13, 2025, 5:46pm UTC](https://community.auth0.com/t/no-payload-for-access-token-with-auth0-nextjs-auth0-version-4-4-2/185420/1 "2025-04-13T17:46:32Z")

</div>

So I have an API and an application both using Auth0, I know the application can successfully authenticate with the api when I use the test curl command to get the access token. However when I try to use a user’s access token I am not able to authenticate and get a token without a payload. Here are the details:

Version: “@auth0/nextjs-auth0”: “^4.4.2”

auth0.ts:

```auto
import { Auth0Client } from "@auth0/nextjs-auth0/server"

export const auth0 = new Auth0Client({
    enableAccessTokenEndpoint: true,
    authorizationParameters: {
        audience: "https://api.azuretestapp.com",
        scope: "profile email openid offline_access"
    }
});

```

```auto
export async function getAccessToken() {
    const session = await auth0.getSession();
    if (!session) {
        throw new Error('Session not found');
    }
    const token = session.tokenSet.accessToken;
    return token;
}

```

Based on my understanding of how this client version works (with limited examples in docs) this should work, however I don’t see what it wrong.

I also tried to use `const accessToken = await getAccessToken()` which worked in previous versions of the client, however I now get: ‘TypeError: Failed to parse URL from /auth/access-token’

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![paulr](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/paulr/32/60368_2.png) [@paulr](https://community.auth0.com/u/paulr)\
**Post date:** [April 15, 2025, 5:57pm UTC](https://community.auth0.com/t/no-payload-for-access-token-with-auth0-nextjs-auth0-version-4-4-2/185420/3 "2025-04-15T17:57:08Z")

</div>

So turns out the issue was not having the root layout wrap the body in the Auth0Provider. Once I added it as seen here it worked:

````auto
 return (
    <html lang="en">
      <head>
        <meta charSet="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      </head>
      <body
        className={`${inter.variable} antialiased relative min-h-screen`}
      >
        <Auth0Provider>
          <main>
            {children}
          </main>
        </Auth0Provider>
      </body>
    </html>
  );
}```

I was also able to use the same token to authenticate with my dotnet api
````

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [April 15, 2025, 6:18pm UTC](https://community.auth0.com/t/no-payload-for-access-token-with-auth0-nextjs-auth0-version-4-4-2/185420/4 "2025-04-15T18:18:22Z")

</div>

Hi @paulr

Welcome to the Auth0 Community!

Thank you for sharing the solution with the rest of us!

If you have any other questions, you can always post again!

Kind Regards,  
Nik

---

<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 29, 2025, 6:18pm UTC](https://community.auth0.com/t/no-payload-for-access-token-with-auth0-nextjs-auth0-version-4-4-2/185420/5 "2025-04-29T18:18:22Z")

</div>

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