I am trying to make the following request:
const options3 = {
url: 'https://{url}.us.auth0.com/oauth/token',
method: 'POST',
headers: {'content-type': 'application/x-www-form-urlencoded'},
params: {
},
body: {
'refresh_token': results['refresh_token'],
'grant_type': 'refresh_token',
'client_id': process.env.CLIENT_ID,
'client_secret': process.env.CLIENT_SECRET,
}
}
I am sure that I am passing correct access token etc but I am somehow getting the following response:
status: 500
json: {
"error": "access_denied",
"error_description": "Cannot read property 'scope' of undefined"
}
Can anybody help with why this issue is happening?
Also, I tried same request with postman, but then the API returns
status: 401,
json: {
"error": "access_denied",
"error_description": "Unauthorized"
}
Though in postman, if I have content-type as application/json
, I start getting 500 as above.
Note: I am making my actual request from Zapier (to authenticate my users over there).
Any help would be very kind. Thank you in advance