I've been trying to obtain an access token from the Indeed API developers. You can find more information about it here:
After creating a fetch request 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);
})
However, I keep getting a 400 BadRequest response that looks like this:
Response {type: 'opaque', url: '', redirected: false, status: 0, ok: false, …}
https://i.sstatic.net/0bFUL.png
The API seems to be working fine when tested with Postman. Is there something wrong with my fetch request?