# JWT returning no data when in React-Native app

**URL:** <https://community.auth0.com/t/jwt-returning-no-data-when-in-react-native-app/89319>\
**Category:** Get Help\
**Tags:** react-native-auth0, jwt, login, auth0\
**Created:** [August 23, 2022, 10:25pm UTC](https://community.auth0.com/t/jwt-returning-no-data-when-in-react-native-app/89319 "2022-08-23T22:25:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jk\_tt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jk_tt/32/12921_2.png) [@jk\_tt](https://community.auth0.com/u/jk_tt)\
**Post date:** [August 23, 2022, 10:25pm UTC](https://community.auth0.com/t/jwt-returning-no-data-when-in-react-native-app/89319/1 "2022-08-23T22:25:29Z")

</div>

Please include the following information in your post:

I am having an issue where the JWT is returning with no data value which I think is causing a 401 on my backend.

If I use my Vue.js application and capture a JWT from it and check [jwt.io](http://jwt.io) for the data value it shows the second code snippet though with actual data not redacted data.

My question is what am I missing that would cause me to not be getting data back as I should?

Reference doc I followed: [Auth0 React Native SDK Quickstarts: Login](https://auth0.com/docs/quickstart/native/react-native/00-login)

- Which SDK this is regarding:  
React native  
“react-native-auth0”
- SDK Version:  
“^2.13.1”
- Platform Version:  
IOS simulator
- Code Snippets/Error Messages/Supporting Details/Screenshots:

```auto
const onLogin = () => {
        console.log(auth0)
        auth0.webAuth
            .authorize({
                scope: 'openid profile email'
            })
            .then(credentials => {
                console.log('Access Token: ', credentials.accessToken)
                globalStorage.set('accessToken', credentials.accessToken)
                navigation.navigate('list')
            })
            .catch(error => console.log(error)) // Eventually send this to backend for crash reporting
    }

```

data from working JWT

```auto
{
  "iss": "https://<my domain>.us.auth0.com/",
  "sub": "auth0|<user ID>",
  "aud": [
    "<my audience>",
    "https://<my domain>.us.auth0.com/userinfo"
  ],
  "iat": 1661293312,
  "exp": 1661379712,
  "azp": "<>",
  "scope": "openid profile email",
  "permissions": [<bunch in here removed for clarity>]
}

```

**Is this a feature request or bug report?**  
no

---

<div class="post-metadata">

**Author:** ![jk\_tt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jk_tt/32/12921_2.png) [@jk\_tt](https://community.auth0.com/u/jk_tt)\
**Post date:** [August 24, 2022, 12:31am UTC](https://community.auth0.com/t/jwt-returning-no-data-when-in-react-native-app/89319/3 "2022-08-24T00:31:06Z")

</div>

Ended up solving it, needed an audience but it isn’t like how it is done with the Vue.js package, it needs to be part of the authorize function. See below for a code example

```auto
.authorize({
    scope: 'openid profile email',
    audience: '<>'
})

```

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [August 24, 2022, 12:51am UTC](https://community.auth0.com/t/jwt-returning-no-data-when-in-react-native-app/89319/4 "2022-08-24T00:51:58Z")

</div>

Thanks for following up with the solution here @jk_tt !

You were previously receiving an [opaque access token](https://auth0.com/docs/secure/tokens/access-tokens#opaque-access-tokens) which is are designed to be used against the /userinfo endpoint. Some more here as well for future reference:

> **[Get Access Tokens](https://auth0.com/docs/secure/tokens/access-tokens/get-access-tokens#control-access-token-audience)**
>
> Learn how to request Access Tokens using the Authorize endpoint when authenticating users and include the target audience and scope of access requested by the app and granted by the user.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [September 8, 2022, 12:51am UTC](https://community.auth0.com/t/jwt-returning-no-data-when-in-react-native-app/89319/5 "2022-09-08T00:51:58Z")

</div>

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