I am trying to generate a JWT token with the getAccessTokenSilently, but when I try to add the audience parameter to the function I get this error: “No overload matches this call.”.
Here is the react typescript code snippet:
function App() {
const {user, isAuthenticated, isLoading , getAccessTokenSilently} = useAuth0();
const [token, setToken] = useState();
useEffect(() => {
(async () => {
try {
const accessToken: any = await getAccessTokenSilently({
audience: ‘API_IDENTIFIER’
});
setToken(accessToken);
} catch (error) {
console.error(‘Error fetching access token’, error);
}
})();
}, [getAccessTokenSilently]);
What can I do to fix this?