I'm trying to get access token from indeed API developers: https://developer.indeed.com/docs/authorization/2-legged-oauth
But after creating fetch like this:
fetch(`https://apis.indeed.com/oauth/v2/tokens`, {
method: 'POST',
mode: 'no-cors',
headers: {
'Content-Type' : 'application/x-www-form-urlencoded',
'Accept':'application/json'
},
body: JSON.stringify({client_id:'10efaf31aee65fb0b3dfe149c1e7c902c6c909bd02b1bec27c0a1ba1ae600bd4',client_secret:'Mtabdk9KbUulH9WQSvK5dvm3FTDWRflWJXjpcHiqNn4KozUBXRfBMA02MnTl01uK',grant_type:'client_credentials', scope:'employer_access'})
})
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
})
But it's always 400 BadRequest and response is:
Response {type: 'opaque', url: '', redirected: false, status: 0, ok: false, …}
API seems working tested by postman, is there any problem with my fetch?