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:
Here is my current config:
<Auth0Provider
domain={Config.AUTH0_DOMAIN!}
clientId={Config.AUTH0_CLIENT_ID!}>
<RootNavigator />
</Auth0Provider>
And this is my authorize() call:
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:
How I know I am getting opaque tokens:
- When trying to use that accessToken, the backend is receiving logs saying that JWT must have 3 parts.
- 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?