# React I get an Opaque JWT when I call getAccessTokenSilently, even after defining the audience and scope in the Provider

**URL:** <https://community.auth0.com/t/react-i-get-an-opaque-jwt-when-i-call-getaccesstokensilently-even-after-defining-the-audience-and-scope-in-the-provider/127358>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, auth0-react\
**Created:** [February 15, 2024, 1:00am UTC](https://community.auth0.com/t/react-i-get-an-opaque-jwt-when-i-call-getaccesstokensilently-even-after-defining-the-audience-and-scope-in-the-provider/127358 "2024-02-15T01:00:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![authMemberuser](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/authmemberuser/32/48744_2.png) [@authMemberuser](https://community.auth0.com/u/authMemberuser)\
**Post date:** [February 15, 2024, 1:00am UTC](https://community.auth0.com/t/react-i-get-an-opaque-jwt-when-i-call-getaccesstokensilently-even-after-defining-the-audience-and-scope-in-the-provider/127358/1 "2024-02-15T01:00:17Z")

</div>

Hi,

I’m currently developing a React application using Auth0 for authentication. I have set up the Auth0Provider with the correct audience and I’m using the getAccessTokenSilently method to retrieve the access token.

However, I’m encountering an issue where I’m receiving an opaque token instead of the expected JWT token. This is causing problems when I try to use this token to authenticate with my API.

I am using the `@auth0/auth0-react` package with version `"^2.0.1"`

I have defined the audience and scope in the Provider in index.js as well:

```auto
 <Auth0Provider
        domain={process.env.REACT_APP_AUTH0_DOMAIN}
        clientId={process.env.REACT_APP_AUTH0_CLIENTID}
        authorizationParams={{
          redirect_uri: window.location.origin,
        }}
        audience="http://localhost:5000"
        scope="openid profile email"
      >
        <App />
      </Auth0Provider>

```

The audience I have specified is the audience of a valid API that I have created from my Auth0 dashboard. I am pretty confident the api has been set up correctly as well as the actual application which is OIDC conformant. I don’t know what to do. This is the example token I receive from getAccessTokenSliently:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/8/1/812ce655526bbcb2bbae880b45bb2a9c12bea8d3.png)

Please help! Thanks!

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [February 15, 2024, 12:47pm UTC](https://community.auth0.com/t/react-i-get-an-opaque-jwt-when-i-call-getaccesstokensilently-even-after-defining-the-audience-and-scope-in-the-provider/127358/3 "2024-02-15T12:47:55Z")

</div>

Hi @authMemberuser ,

Thank you for describing your issue!

> [@authMemberuser](#):
>
> The audience I have specified is the audience of a valid API that I have created from my Auth0 dashboard.

Did you first complied your app without setting the “audience” parameter and updated your code later?  
Could you please restart your app / crash the process and start it again?

Please let us know if that worked!

---

<div class="post-metadata">

**Author:** ![authMemberuser](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/authmemberuser/32/48744_2.png) [@authMemberuser](https://community.auth0.com/u/authMemberuser)\
**Post date:** [February 15, 2024, 7:25pm UTC](https://community.auth0.com/t/react-i-get-an-opaque-jwt-when-i-call-getaccesstokensilently-even-after-defining-the-audience-and-scope-in-the-provider/127358/4 "2024-02-15T19:25:07Z")

</div>

Hi @marcelina.barycka , by ‘complied’, do you mean compiled, and I am assuming you are referring to my React frontend app right? If we are talking about the React frontend app, then Yes, I have terminated it, closed the terminal, and then restarted it again, but I still get the same issue.

---

<div class="post-metadata">

**Author:** ![authMemberuser](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/authmemberuser/32/48744_2.png) [@authMemberuser](https://community.auth0.com/u/authMemberuser)\
**Post date:** [February 17, 2024, 3:26pm UTC](https://community.auth0.com/t/react-i-get-an-opaque-jwt-when-i-call-getaccesstokensilently-even-after-defining-the-audience-and-scope-in-the-provider/127358/5 "2024-02-17T15:26:19Z")

</div>

Hi, I’m still having this issue

---

<div class="post-metadata">

**Author:** ![didier7](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@didier7](https://community.auth0.com/u/didier7)\
**Post date:** [March 12, 2024, 4:22pm UTC](https://community.auth0.com/t/react-i-get-an-opaque-jwt-when-i-call-getaccesstokensilently-even-after-defining-the-audience-and-scope-in-the-provider/127358/6 "2024-03-12T16:22:28Z")

</div>

For anyone facing this same issue, I found the solution here: [Invalid access token payload, jwt encrypted with A256GCM](https://community.auth0.com/t/invalid-access-token-payload-jwt-encrypted-with-a256gcm/77893)  
It was indeed due to the audience not properly configured.

---

<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:** [March 26, 2024, 4:22pm UTC](https://community.auth0.com/t/react-i-get-an-opaque-jwt-when-i-call-getaccesstokensilently-even-after-defining-the-audience-and-scope-in-the-provider/127358/7 "2024-03-26T16:22:54Z")

</div>

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