I'm trying to log into my application. It should return JWT token, and when I debugged my backend it worked - went through the method to the return statement. Problem is, my frontend didn't get it. Browser's network tracker says it returned 204 No Content, console logs 500 (Internal Server Error)
and:
"Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:4200, *', but only one is allowed. Origin 'http://localhost:4200' is therefore not allowed access."
First it said there was no Access-Control-Allow-Origin header, but I added
<add name="Access-Control-Allow-Origin" value="*" />
to my webconfig, now the error is as above.
Problem is, I've got a different app running those exact same settings and it has no problems :/ only difference is that I'm using Identity and Jwt tokens in this one, but it shouldn't affect the application.
In startup, I've enabled cors and used those options:
app.UseCors(builder =>
builder.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
this should be enough to allow any origin, shouldn't it? I've also got
Access-Control-Allow-Origin:* on response headers
no idea where did this localhost:4200, *
in the console comes from...