I have created a webapi with jwt authentication. I am able to get response without authorization, when i have added authorize attribute to controller, its giving me unauthorized which is correct. But when i sent authorization header its giving CORS error and request not working. Is there any attribute i need to send?
this.httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': 'Bearer '+ this.readCookie()
})
};
return this.http.get("http://localhost:50507/api/employee").toPromise();
Thanks
What I have tried:
Tried with $.ajax getting same error.