JWT returning no data when in React-Native app

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 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

  • 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:
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

{
  "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

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

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

Thanks for following up with the solution here @jk_tt !

You were previously receiving an opaque access token which is are designed to be used against the /userinfo endpoint. Some more here as well for future reference:

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