Auth0 Home Blog Docs

Expo Audience is incorrect

I’ve implemented the expo auth0 example seen here https://github.com/expo/auth0-example
It’s almost code for code, creating a query string from an object and using that URL to authorize. The code below is where all the magic happens

const queryParams = toQueryString({
        client_id: auth0ClientId,
        redirect_uri: redirectUrl,
        response_type: 'id_token', // id_token will return a JWT token
        nonce: 'nonce', // ideally, this will be a random value
        scope: 'openid profile', // retrieve the user's profile
        audience: 'https://api.myapp.com
    });
    const authUrl = `${auth0Domain}/authorize` + queryParams;
    const response = await AuthSession.startAsync({ authUrl });

Everything works great for the most part. The user is authenticated and redirect back to our app with a JWT.

The problem is that when I try to access endpoints on our API it tell me that the audience is invalid. The audience listed in the token is the auth0 clientID of the mobile app. I’ve added an audience parameter to my auth url, I’ve tried changing it to ‘aud’, I’ve looked all around and cant find any community docs on it.