I am trying to retrieve users from API using Axios to localhost/3000 like this
...
const accessToken = await getAccessTokenSilently({
audience: `https://${domain}/api/v2/`,
scope: "read:users",
});
...
const options = {
method: "GET",
url: `${api}/users`,
params: {
q: '',
search_engine: 'v3',
},
headers: {
Authorization: `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
};
...
return axios(options)
.then((response) => response.data)
.catch((error) => {
console.error(error);
});
...
I got the token successfully but always getting an error message:
Error: Request failed with status code 403
I know it is an access token issue, but I don’t know how to fix it, Please Help!