skfabc
August 29, 2023, 2:41pm
1
Hello, I’m getting an empty payload in the token returned from getAccessTokenSilently.
I am setting the audience parameter and have confirmed its value as well as the value for scope.
Can someone help me understand what’s going wrong? Below is the code.
Thank You!
useEffect(() => {
(async () => {
try {
const token = await getAccessTokenSilently({
authorizationParams: {
audience: ‘https://api.shawnapp.systems/ ’,
scope: ‘openid profile email offline_access’,
}
});
const response = await fetch('https://shawnprod.shawn.auth0.com/userinfo', {
headers: {
Authorization: `Bearer ${token}`,
},
});
setPosts(await response.json());
}
catch (e) {
console.error(e);
}
})();
}, [getAccessTokenSilently]);
1 Like
tyf
August 29, 2023, 3:27pm
2
Hey there @skfabc welcome to the community!
What does the access token look like when decoded at jwt.io ? Is the audience param you’re passing the exact same as the API identifier listed under the API registered in Auth0?
Keep us posted!
skfabc
August 30, 2023, 3:16pm
4
Hi, @tyf ,
I’ve confirmed that the audience param I’m passing is exactly the same as in Auth0. I DM’ed you the access token screen in jwt.io .
Thanks!
I am also facing exact same issue with react18, react-router-6 and “@auth0 /auth0-react”: “^2.2.1”
I am passing audience too
1 Like
skfabc
September 7, 2023, 12:59pm
6
UPDATE: The issue I was having was due to the way we’d configured Auth0 between two different tenants. Not a coding issue.
1 Like
tyf
September 7, 2023, 11:59pm
7
Hey @skfabc thanks for the update! Glad you were able to get this sorted
tyf
September 8, 2023, 12:00am
8
Hey there @bagulm123 ! Are you still experiencing the same issue? If so, I recommend opening a new topic with as much detail as you can provide.
Thanks!
system
Closed
September 22, 2023, 12:01am
9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.