SecuringBlazorClientSideApplications icon indicating copy to clipboard operation
SecuringBlazorClientSideApplications copied to clipboard

Got CORS error when calling API: when app.UseAuthorization() is placed before app.UseAuthentication()

Open hanslai opened this issue 4 years ago • 1 comments

Step to duplicate

  1. Run “git clone” download the project
  2. Open Finished sample\BethanysPieShopHRM.App.sln with Visual Studio 2019
  3. Set multiple startup projects (api, app, Marvin.IDP)
  4. Run the projects
  5. Login as Jack
  6. Click the “employeeoverview” link in NavMenu
  7. Got “CORS” error

Solution In API level, startup.cs replace app.UseAuthentication(); before app.UseAuthorization(); Program works fine now and able to get all employee

hanslai avatar Dec 02 '20 07:12 hanslai

Thanks for noticing, that was indeed a mistake. I just fixed it in the finished solution, should work now :)

KevinDockx avatar Dec 02 '20 12:12 KevinDockx