I use the Angular frontend to connect to the WEB API 2 server. The following is a faulty use case. When a user registers, upon successful registration they must be registered in the system and redirected to a new page to collect additional information. I use TOKENS for authentication.
I have included CORS in the WebAPI configuration:
var cors = new EnableCorsAttribute("http://localhost:7812", "*", "*"); config.EnableCors(cors);
The registration request was successful, and the response headers have the required CORS headers:
**Access-Control-Allow-Credentials:true Access-Control-Allow-Origin:http:
In the next step, I try to log in to the user system. As part of the login, the front end requests TOKEN from the server in Request URL:http://localhost:7802/token . The request header sends the Origin header again Origin:http://localhost:7812 , but this time I get an error: XMLHttpRequest cannot load http://localhost:7802/token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:7812' is therefore not allowed access. XMLHttpRequest cannot load http://localhost:7802/token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:7812' is therefore not allowed access.
Does anyone have any idea?
Greg
source share