I have put my IS4 on a server and lets call it http://test.myis4.com. Now I am trying to login with an angular application against it, however I keep getting blocked by CORS. The angular client is being served with an MVC Core application and it runs on http://localhost:5002 port. I have tried to do this from my localhost by running it on that port.
On the IS4 server I have tried adding on the client the following:
new Client {
// code is omitted
AllowedCorsOrigins = new List<string>() { "http://localhost:5002" }
}
With the above I still get the CORS error, then I have tried adding it to the services direclty:
var cors = new DefaultCorsPolicyService(null)
{
AllowedOrigins = { "http://localhost:5002" }
};
services.AddSingleton<ICorsPolicyService>(cors);
services.AddIdentityServer()
//rest omitted
The above still gave me the same CORS error, my last attempt was to add it through application builder as such:
app.UseCors(builder => builder.WithOrigins("http://localhost:5002").AllowAnyHeader());
app.UseIdentityServer();
//rest omitted
With this last attempt it still did not work. I'm not quire sure what I'm doing wrong at this point. Any suggestions?