After receiving an access token by using the access payload, I make a request to get a user by their email using the user payload. I then get the error ‘Invalid signature received for JSON Web Token validation’ as a response. Does the access token need to be modified before it can be used for authorization with requests?. What am I doing wrong here?
const access = {
method: 'POST',
url: 'https://{MY COMPANY DOMAIN}.auth0.com/oauth/token',
headers: {'content-type': 'application/json'},
body:{
grant_type: 'client_credentials',
client_id: '{My Non Interactive Client ID}',
client_secret: '{My Non Interactive Client Secret}',
audience: 'https://{MY COMPANY DOMAIN}.auth0.com/api/v2/'
},
json: true
};
const user = {
url: `https://{MY COMPANY DOMAIN}.auth0.com/api/v2/users-by-email?email=${encoded}`,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${access_token}`
}
};