For Identity Server 4, I would like to know the difference between adding a Client specific CORS
new client() {client.AllowedCorsOrigins = new List<string>() { "http://localhost:4222" };}
and Adding the set up in Startup.cs Configure
services.AddCors(options =>
{
// this defines a CORS policy called "default"
options.AddPolicy("default", policy =>
{
policy.WithOrigins("Origin")
.AllowAnyHeader()
.AllowAnyMethod();
});
});
For context I've recently been learning about the methods ReactJS SPA needs to use when accessing Single Sign-on through another party, and as it stands I have implemented the Library 'oidc-client-js' and use the Authorisation code flow with PKCE because that it the standard implementation, and everything works. But I need help in understanding something:
- If I remove the Cors options in StartUp the authorisation will fail and return a
origin has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource, why is the client Cors setting not enough? (is it maybe used further down the line with an API call?)
Any information you know of would really help, thanks.
