Hello guys,
for months now I have been using the auth0-spa-js SDK with my dev tenant and my dev application for login.
await createAuth0Client({
domain: 'my-domain',
client_id: 'xyz012',
audience: undefined, // remember this, it says it is optional
redirect_uri: redirectUri,
cacheLocation: 'memory',
useRefreshTokens: true,
})
The documentation of the SDK https://auth0.github.io/auth0-spa-js/interfaces/auth0clientoptions.html#audience says audience is optional, so setting it to undefined should be no problem, right? Yeah it works! I login and get a real jwt access token.
Now here is the kicker. Today I finally deployed to production using my auth0 production tenant and application. Remember audience is still undefined! Yeah no problem, right? Wrong! Getting unauthorized exceptions from my API now. What the frick? The reason for this is, that I now get an opaque access token in production tenant after login! Googled a bit and found this Why is my access token not a JWT? (Opaque Token). And it says you have to send a audience to get a real jwt token, right?
So now I am totally confused why its working on one tenant without audience and on one it doesn’t.
What could be the problem? Do you have any ideas? Am I the problem?