Code;
this.http.post(this.endpoint + "api/auth/signin", {"username": handle, "password": password}).subscribe(r => {
// @ts-ignore
if (r["status"] === "authorized") {
localStorage.setItem("status", "signed_in")
// @ts-ignore
localStorage.setItem("token", r["token"])
}
})
Errors;
signin:1 Access to XMLHttpRequest at 'apiurl' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
signin:1 Access to XMLHttpRequest at 'apiurl' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
Server has these headers just for testing;
header('HTTP/1.1 200 OK')
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: *');
header('Access-Control-Allow-Headers: *');
And the funny thing is when I add xmlrequest function to the console it works but not on angular version of ionic framework. I am going nuts. Please help...