# Empty payload in JWT Authorization tokens - Audience IS defined (I think?)

**URL:** <https://community.auth0.com/t/empty-payload-in-jwt-authorization-tokens-audience-is-defined-i-think/116248>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [September 14, 2023, 5:31pm UTC](https://community.auth0.com/t/empty-payload-in-jwt-authorization-tokens-audience-is-defined-i-think/116248 "2023-09-14T17:31:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![login](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/login/32/48966_2.png) [@login](https://community.auth0.com/u/login)\
**Post date:** [September 14, 2023, 5:31pm UTC](https://community.auth0.com/t/empty-payload-in-jwt-authorization-tokens-audience-is-defined-i-think/116248/1 "2023-09-14T17:31:54Z")

</div>

I’m currently developing a React Single Page Application (SPA) that uses Auth0 for authentication. I have successfully implemented login and logout features. However, when request an Authorization JWT with getTokenSilently() I am retrieving have an empty payload when decoded. For now I’m just logging it to my browsers console in a local test environment. For example: eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9kZXYtdzAxODFhcXNobGw1MDMzbC51cy5hdXRoMC5jb20vIn0…thF3uZU-GjTkcNVo.EQawZb4Ebgww3ZT-Pa73eoJ62qLQ0HSIswroGiecQZHGdZLw-953s6asccnawPD9HwSObZ3JcsbP8HAFarNf2p5Zrr2sbp4QvGxfB6RgpWZTxEK2Tntu7X7w9i\_7z2Iw8c\_3lUZPnHe0\_4OLaHnPyetzk8\_Pqm2-JcELrNIwvRPTD1QmdMsbyvz6\_u9kANS181FH7wSyxtt5UP5Hu\_BnQ3lmEQhB5yMvL42PjaAsoaclxEdQ0EQmcCRdnNrQVqnKadZumwvs2jQ-A-onQI9lL3rhlPEktJP8Sy-UyhRv-U\_Az6MmY4D92-VRD\_AjXhXLggV7iXMS8hZM9N\_cDDCA5skg.Fuf3LqTHjNuCZj\_fS8P8HQ  
**Issue Details:**  
Technology Stack: ReactJS with Auth0 SPA SDK  
Auth0 SDK Version: @auth0/auth0-react": “^2.1.0”,  
“@auth0/auth0-spa-js”: “2.0.3”,  
Browser: Tried on multiple browsers including Chrome and Safari, and also in Incognito mode Error Messages: None  
**Steps to Reproduce:**  
User logs in via Auth0.  
React App retrieves the token.  
React App writes writes the token to console for debugging purposes.

Code Snippets:

[auth-provider.js](https://gist.github.com/jrolo-ris/17884f5041d3a28e674ac07da7fcde36) [app.js](https://gist.github.com/jrolo-ris/12406b0409190893fc2cc987f01481da)

**What I have Tried:**  
Logged in and out multiple times, also in incognito mode in case of cacheing.  
Checked Auth0 Dashboard logs for any signs of errors or irregularities.  
Ensured that the Auth0Client object is initialized with an audience, which is an API that I crated in the Auth0 Dashboard. Reviewed and followed Auth0 SPA SDK documentation - though I am a beginner and most likely have something configured wrong.

---

<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:** [September 14, 2023, 8:11pm UTC](https://community.auth0.com/t/empty-payload-in-jwt-authorization-tokens-audience-is-defined-i-think/116248/3 "2023-09-14T20:11:39Z")

</div>

Hi @login,

Have you made sure that your auth0\_config.json file has included your `audience`?

If not, you could always override it by passing it in the `getTokenSilently()` method:

```auto
const token = await getAccessTokenSilently({
  authorizationParams: {
    audience: 'https://api.example.com/',
    scope: 'read:posts',
  }

```

(Reference: [https://github.com/auth0/auth0-react/blob/main/EXAMPLES.md#call-an-api](https://github.com/auth0/auth0-react/blob/main/EXAMPLES.md#call-an-api))

Please let me know how it goes for you.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![login](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/login/32/48966_2.png) [@login](https://community.auth0.com/u/login)\
**Post date:** [September 14, 2023, 9:21pm UTC](https://community.auth0.com/t/empty-payload-in-jwt-authorization-tokens-audience-is-defined-i-think/116248/4 "2023-09-14T21:21:27Z")

</div>

Thanks so much for the help!  
I have made sure to explicitly state it, but that did not change the result. One thing to note - I’m using the auth0-spa-js library in my auth-provider.js code that I shared. Could that have an impact on how I should be getting the token?

---

<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:** [September 18, 2023, 3:42pm UTC](https://community.auth0.com/t/empty-payload-in-jwt-authorization-tokens-audience-is-defined-i-think/116248/5 "2023-09-18T15:42:56Z")

</div>

Hi @login,

Can you please verify that the audience is set by decoding your JWT token on [jwt.io](http://jwt.io) and see if there is a value set for the `aud` claim?

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:** [October 2, 2023, 3:43pm UTC](https://community.auth0.com/t/empty-payload-in-jwt-authorization-tokens-audience-is-defined-i-think/116248/6 "2023-10-02T15:43:09Z")

</div>

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