Solve CORS problem with web api .NET with OWIN authentication

Sara Ahsain
Jan 19, 2022
  • Install the package Microsoft.AspNet.WebApi.Cors
  • Add in Startup.cs: app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
  • Do not add in SimpleAuthorizationServerProvider.cs: context.OwinContext.Response.Headers.Add(“Access-Control-Allow-Origin”, new[] { “*” });

In case the problem still persists
- Add in Startup.Auth.cs: app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

--

--