The following function returns an error
{"statusCode":401,"error":"Unauthorized","message":"Bad audience: http://localhost:3001/admin https://dev-rqbvmubwc6xeogdn.us.auth0.com/userinfo"}
But in my code I specify a different audience.
const fetchListofAdmins = async ()=>{
try{
const token = await getAccessTokenSilently({
authorizationParams: {
audience:'https://dev-rqbvmubwc6xeogdn.us.auth0.com/api/v2/',
scope: 'read:current_user'
}
})
console.log(token);
const options = {
method: 'GET',
url: `${MANAGEMENT_API}roles/${ROLE_ID}/users`,
headers: {
Authorization: `Bearer ${token}`
}
}
const response = await axios.request(options)
adminArray = (response.data)
}catch(error) {
console.log(error.message);
}
}
Where is getAccessTokenSilently() getting these audience strings from?
My function returns the expected data when using the ‘Test’ token