# Nextjs app sending opaque token to my API

**URL:** <https://community.auth0.com/t/nextjs-app-sending-opaque-token-to-my-api/117666>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, nextjs-auth0\
**Created:** [October 3, 2023, 2:06pm UTC](https://community.auth0.com/t/nextjs-app-sending-opaque-token-to-my-api/117666 "2023-10-03T14:06:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nadajp](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nadajp/32/51320_2.png) [@nadajp](https://community.auth0.com/u/nadajp)\
**Post date:** [October 3, 2023, 2:06pm UTC](https://community.auth0.com/t/nextjs-app-sending-opaque-token-to-my-api/117666/1 "2023-10-03T14:06:05Z")

</div>

Hi, I have a Java Spring Boot backend API and a Nextjs frontend app. After logging in, I try to access a protected endpoint and see this error in my API: `Caused by: org.springframework.security.oauth2.jwt.BadJwtException: An error occurred while attempting to decode the Jwt: Encrypted JWT rejected: No JWE key selector is configured`.

I see from previous topics that this is due to the access token being opaque. I checked to make sure I am sending the correct audience:

```auto
export default handleAuth({
  login: handleLogin({
    authorizationParams: {
        audience: 'https://lingua-books.com',
        scope: 'openid offline_access' 
    }
  })

```

Here is where I make the API call with the token:

```auto
const config = {
        headers: { Authorization: `Bearer ${accessToken}` }
     };

      // Make a POST request to your Java backend API
      const response = await axios.post(
        `${process.env.NEXT_PUBLIC_API_URL}/sellers`,
        sellerData,
        config
      );

```

I used the Authentication API Debugger, as in the video about audiences and received a proper token with aud in it. Am I missing some additional config in my nextjs app?

---

<div class="post-metadata">

**Author:** ![nadajp](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nadajp/32/51320_2.png) [@nadajp](https://community.auth0.com/u/nadajp)\
**Post date:** [October 3, 2023, 4:22pm UTC](https://community.auth0.com/t/nextjs-app-sending-opaque-token-to-my-api/117666/2 "2023-10-03T16:22:05Z")

</div>

UPDATE: This was fixed by adding a default audience in my auth0 dashboard.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/3/b/3b1ed0fca443c2fab014ba09b7c9cb287b6ac7e1.png)

---

<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:** [October 17, 2023, 4:22pm UTC](https://community.auth0.com/t/nextjs-app-sending-opaque-token-to-my-api/117666/3 "2023-10-17T16:22:19Z")

</div>

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