The issue is likely caused by incorrect middleware order in Startup.cs
. Try the following modification:
app.UseHttpsRedirection();
app.UseRouting();
app.UseCors("AllowAll");
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
You can also refer to this document: