# Added Audience and STILL getting Opaque token instead of JWT token with React Native

**URL:** <https://community.auth0.com/t/added-audience-and-still-getting-opaque-token-instead-of-jwt-token-with-react-native/151171>\
**Category:** Get Help\
**Tags:** react-native-auth0, sdks-quickstarts\
**Created:** [November 7, 2024, 11:17pm UTC](https://community.auth0.com/t/added-audience-and-still-getting-opaque-token-instead-of-jwt-token-with-react-native/151171 "2024-11-07T23:17:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![engineering.dev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/engineering.dev/32/61266_2.png) [@engineering.dev](https://community.auth0.com/u/engineering.dev)\
**Post date:** [November 7, 2024, 11:17pm UTC](https://community.auth0.com/t/added-audience-and-still-getting-opaque-token-instead-of-jwt-token-with-react-native/151171/1 "2024-11-07T23:17:07Z")

</div>

Hello,

I’m currently developing a React Native application using Auth0 for authentication. I have set up the Auth0Provider with the correct audience and I’m using the getCredentials() method to retrieve the access token.

However, I’m encountering an issue where I’m receiving an opaque token instead of the expected JWT token. This is causing problems when I try to use this token to authenticate with my API.

I already referred to these other issues and none of them solved the problem for me:  
[https://community.auth0.com/t/react-native-invalid-signature-on-access-token/116632](https://community.auth0.com/t/react-native-invalid-signature-on-access-token/116632)

> [@Added Audience and STILL getting Opaque token instead of JWT token with React](https://community.auth0.com/t/added-audience-and-still-getting-opaque-token-instead-of-jwt-token-with-react/110636):
>
> Hello, I’m currently developing a React application using Auth0 for authentication. I have set up the Auth0Provider with the correct audience and I’m using the getAccessTokenSilently method to retrieve the access token. However, I’m encountering an issue where I’m receiving an opaque token instead of the expected JWT token. This is causing problems when I try to use this token to authenticate with my API. Good to note, my client side code is deployed with AWS Amplify Here’s the relevant code…

> [@Make Request to Auth0 api from react native app](https://community.auth0.com/t/make-request-to-auth0-api-from-react-native-app/68746):
>
> I have a react native app authenticated with Auth0. I have an API that uses react native. When a user signs in, i take the accessToken that is given for that user, and I make request to the API with the accessToken set as the authorization header. I do so like this: const requestHeader = { headers: { Authorization: `Bearer ${accessToken}`, } } axios.post(API\_BASE + '/api/example/', requestHeader) The accessToken is something short like this: aBQdd0kOvb1pNj-…

Here is my current config:

```auto
 <Auth0Provider
    domain={Config.AUTH0_DOMAIN!}
    clientId={Config.AUTH0_CLIENT_ID!}>
    <RootNavigator />
</Auth0Provider>

```

And this is my authorize() call:

```auto
const handleLogin = async () => {
    try {
      await authorize({
        audience: Config.AUTH0_AUDIENCE,
        scope: 'openid profile email offline_access',
      });
      const credentials = await getCredentials();
      await authenticate(credentials?.accessToken!);
    } catch (e) {
      ToastService.onDanger({
        title: error?.message || t('errors.server-unable'),
      });
    }
  };

```

API properly configured with the same audience url configured in the App:

 ![Screenshot 2024-11-07 at 20.08.09](https://global.discourse-cdn.com/auth0/original/3X/a/8/a8479f228686ef57b3ba9d79b3f53ccec82198ea.png)

How I know I am getting opaque tokens:

1. When trying to use that accessToken, the backend is receiving logs saying that JWT must have 3 parts.
2. Also, I could use this access token to call the /userinfo endpoint (opaque tokens are used for that).

I’ve already applied different solutions and configs here and nothing worked. Can someone please help me with this?

---

<div class="post-metadata">

**Author:** ![engineering.dev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/engineering.dev/32/61266_2.png) [@engineering.dev](https://community.auth0.com/u/engineering.dev)\
**Post date:** [November 8, 2024, 8:02pm UTC](https://community.auth0.com/t/added-audience-and-still-getting-opaque-token-instead-of-jwt-token-with-react-native/151171/3 "2024-11-08T20:02:00Z")

</div>

Forgot to mention:

react-native version: 0.72.12  
react-native-auth0 version: 3.2.1

And this is the req/res from the call that Auth0 Webmodal makes internally (real values omitted):

**Request:**

POST [https://zzzzz.auth0.com/oauth/token](https://zzzzz.auth0.com/oauth/token)

```auto
{
  "code": "qOwUxrVRdW56nMhXOzMR0Prfi5mVFOxxxxxxxxxx",
  "code_verifier": "8oSRbIN3r3Zwe-kukkdzjCSuvKn-xxxxxxxxx",
  "redirect_uri": "com.xxx.xxx.auth0://yyyy.com/ios/com.xxx.xxx/callback",
  "grant_type": "authorization_code",
  "client_id": "ucZ8TGpHCHF9FqRiEZppxxxxxxx"
}

```

**Response:**

```auto
{
  "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InRVNVNqWHNmVVRaVjJrR2FtMDdDTSJ9.eyJodHRwczovL2NoYXJ0ZXJ1cC5jb20vZW1haWwiOiJicnlhbitnaWFudHM1QGNoYXJ0ZXJ1cC5jb20iLCJodHRwczovL2NoYXJ0ZXJ1cC5jb20vYXBwbGljYXRpb24iOiJkcml2ZXJfbW9iaWxlX2FwcCIsImlzcyI6Imh0dHBzOi8vbG9naW4uZGV2LmNoYXJ0ZXJ1cC5jb20vIiwic3ViIjoiYXV0aDB8ODE0NzgiLCJhdWQiOlsiaHR0cHM6Ly9jaGFydGVydXAtZGV2LnVzLmF1dGgwLmNvbS9hcGkvdjIvIiwiaHR0cHM6Ly9jaGFydGVydXAtZGV2LnVzLmF1dGgwLmNvbS91c2VyaW5mbyJdLCJpYXQiOjE3MzEwOTU2ODksImV4cCI6MTczMTE4MjA4OSwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCBvZmZsaW5lX2FjY2VzcyIsImF6cCI6InVjWjhUR3BIQ0hGOUZxUmlFWnBwNFdHNjlZejdNSTBxIn0.Z3GVQjSDg8gnABmgwN8sK9VBFV6gQJv6S8tbgC-u7oCrEWMo0xm8j5v8m6nnh0Fdxxxxxxxxxxxxxxxxxxxx",
  "refresh_token": "v1.MbOLx0NYc1IuFxyREpXbWRD4aNbakE5ISAihbbJnFf5x0hDB181b7Sxxxxxxxxxx",
  "id_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InRVNVNqWHNmVVRaVjJrR2FtMDdDTSJ9.eyJnaXZlbl9uYW1lIjoiQnJ5YW4iLCJmYW1pbHlfbmFtZSI6IkdpYW50czUiLCJuaWNrbmFtZSI6ImJyeWFuK2dpYW50czUiLCJuYW1lIjoiQnJ5YW4gR2lhbnRzNSIsInBpY3R1cmUiOiJodHRwczovL3NlY3VyZS5ncmF2YXRhci5jb20vYXZhdGFyLzk0MjU3OTg4MzljZTQxOTVkMzZiYWUzN2UzZGQ4ZGFjP3M9NDgwJnI9cGcmZD1odHRwcyUzQSUyRiUyRmNkbi5hdXRoMC5jb20lMkZhdmF0YXJzJTJGYmcucG5nIiwidXBkYXRlZF9hdCI6IjIwMjQtMTEtMDhUMTk6NDY6NDIuODQwWiIsImVtYWlsIjoiYnJ5Yxxxxxxxxxxxxxx",
  "scope": "openid profile email offline_access",
  "expires_in": 86400,
  "token_type": "Bearer"
}

```

---

<div class="post-metadata">

**Author:** ![engineering.dev](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/engineering.dev/32/61266_2.png) [@engineering.dev](https://community.auth0.com/u/engineering.dev)\
**Post date:** [November 12, 2024, 1:07pm UTC](https://community.auth0.com/t/added-audience-and-still-getting-opaque-token-instead-of-jwt-token-with-react-native/151171/4 "2024-11-12T13:07:17Z")

</div>

Problem was solved.  
It was a token resolution problem at backend side.

---

<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:** [December 10, 2024, 7:29pm UTC](https://community.auth0.com/t/added-audience-and-still-getting-opaque-token-instead-of-jwt-token-with-react-native/151171/5 "2024-12-10T19:29:56Z")

</div>

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