Hi all
I’m trying to call my external api in my server side rendered page, with an access_token because access requires a certain scope.
const tokenCache = auth0.tokenCache(context.req, context.res);
const { accessToken } = await tokenCache.getAccessToken({
scopes: ['read:messages']
});
todos = await axios.get("http://localhost:3010/api/private", {
'Authorization' : `Bearer ${accessToken}`
})
.then(response => todos = response.data)
.catch(error => console.error(error));
I added audience in my initAuth file like here https://github.com/auth0/nextjs-auth0/issues/90
The value of my audience is the same as it is in the API settings.
But I get the error in the title of this post…