I am writing an angular application and I am trying to connect to our API using a service $http.
$http.post('https://backend-test/***/v001/login', {'userName': 'admin', 'password': 'passtest'}, {headers: {'Accept': 'application/json', 'Content-Type': 'application/json'}}).then(function success(response) {
console.log(response);
});
However, I keep getting this error:
XMLHttpRequest cannot load https: // backend-test / *** / v001 / login. response for pre-flight has an invalid HTTP status code 403
An OPTIONS request is also presented instead of a POST request:
Request Method: OPTIONS
It is strange that it works correctly when I use this tool:
https://www.hurl.it/
Any thoughts?
source
share