I am setting up a new ASP.NET Core Web API with Work Or School Account Authentication. This API will be consumed by an Angular 8.2 application. I added CORS (Microsoft.AspNetCore.Cors - version 2.2.0) from Nuget and configured my Startup.cs file to AddCors and UseCors. I have configured as AllowAnyOrigin, AllowAnyMethod, AllowAnyHeader. My UseCors statement is above UseMVC statement too.
The API works fine when executed independently on web browser. However, when I plug this into the Angular App, I am getting below error.
Access to XMLHttpRequest at 'https://localhost:44342/api/Values' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Why is AllowAnyOrigin is not being recognised?
Can someone help me?