When I try to access the below API, I am getting the response token in postman.
https://{{dev}}/oauth/token
Whereas in my angular web application (http://localhost:4200) API call is returning the status code as 200 but I am getting CORS error and I did not get any response.
Even I tried using plain javascript and tried calling the API, I am still getting the same CORS error.
Can anyone please help me to resolve this.
Attaching the javascript code below for your reference. .
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=");
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("grant_type", "client_credentials");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://xxx.xxxx.pure.cloud/oauth/token", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));