# ReactJS sdk is giving me a A256GCM encoded JWT

**URL:** <https://community.auth0.com/t/reactjs-sdk-is-giving-me-a-a256gcm-encoded-jwt/182313>\
**Category:** Get Help\
**Tags:** classic-universal-login-experience, login-experience\
**Created:** [February 17, 2025, 8:38pm UTC](https://community.auth0.com/t/reactjs-sdk-is-giving-me-a-a256gcm-encoded-jwt/182313 "2025-02-17T20:38:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![infodbio](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/infodbio/32/72993_2.png) [@infodbio](https://community.auth0.com/u/infodbio)\
**Post date:** [February 17, 2025, 8:38pm UTC](https://community.auth0.com/t/reactjs-sdk-is-giving-me-a-a256gcm-encoded-jwt/182313/1 "2025-02-17T20:38:12Z")

</div>

The ReactJS auth0 sdk is allowing my user to sign in successfully, but the JWT I receive after they login is the wrong encoded format.

In auth0 dashboard everything is set to RS256, I do not have encrypted tokens enabled.  
My app is a Single Page App in auth0 dashboard.

In react I am logging in the user with this:

```auto
<button onClick={() => loginWithRedirect({
      audience: "<Auth0 Management API Audience>",
      scope: "openid profile email"
    })}>Log In</button>

```

Then I request the token like this:

```auto
const token = await getAccessTokenSilently({
        audience: "<Auth0 Management API Audience>",
      });

```

I searched the web yesterday and everyone was saying it’s because the audience was not specified when logging in & requesting the token, however, that did not resolve my issue when I applied the audience value.

---

<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:** [February 18, 2025, 12:22am UTC](https://community.auth0.com/t/reactjs-sdk-is-giving-me-a-a256gcm-encoded-jwt/182313/3 "2025-02-18T00:22:43Z")

</div>

Hi @infodbio

Welcome to the Auth0 Community!

When you login to Auth0 and don’t specify an **audience** , you will get an [opaque access token](https://auth0.com/docs/secure/tokens/access-tokens#opaque-access-tokens). It looks like a regular JWT, but actually it’s a self contained encrypted JWT. The only way to validate an opaque token is to call the server that issued the token, in this case the `/userinfo` endpoint.

In order to get an [JWT](https://auth0.com/docs/secure/tokens/access-tokens#jwt-access-tokens). You need to [create a custom api](https://auth0.com/docs/get-started/auth0-overview/set-up-apis). Then use this as the `audience` in your react app to login:

```auto
<Auth0Provider
      domain="YOUR_AUTH0_DOMAIN"
      clientId="YOUR_AUTH0_CLIENT_ID"
      redirectUri={window.location.origin}
      audience="YOUR_API_IDENTIFIER"

```

This will provide you a JWT when you call the `getAccessTokenSilently()` method.

Then you can specify the same API as the audience in your api:

```auto
const jwtCheck = auth({
  issuerBaseURL: "https://<DOMAIN>", 
  audience: "YOUR_API_IDENTIFIER",
});

```

Hope this clarifies things a bit, let me know if you have any other questions or still having issues!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![infodbio](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/infodbio/32/72993_2.png) [@infodbio](https://community.auth0.com/u/infodbio)\
**Post date:** [February 18, 2025, 4:46pm UTC](https://community.auth0.com/t/reactjs-sdk-is-giving-me-a-a256gcm-encoded-jwt/182313/4 "2025-02-18T16:46:33Z")

</div>

Thank you for your reply. I found the solution shortly after posting and forgot to update it, I had to add the audience and scope to my authorizationParams under my Auth0Provider

---

<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:** [February 18, 2025, 4:56pm UTC](https://community.auth0.com/t/reactjs-sdk-is-giving-me-a-a256gcm-encoded-jwt/182313/5 "2025-02-18T16:56:12Z")

</div>

Hi again.

Thanks for letting us know and sharing the solution with us!

If you have any other questions, feel free ot leave another reply or post again on the community!

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:** [March 4, 2025, 4:56pm UTC](https://community.auth0.com/t/reactjs-sdk-is-giving-me-a-a256gcm-encoded-jwt/182313/6 "2025-03-04T16:56:43Z")

</div>

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