How to fix 'Authorization in ASP.NET Core' with 401 Unauthorized

This post shows you how to fix 'Authorization in ASP.NET Core' with 401 Unauthorized when using [Authorize] attribute

If you got a problem problem when sending request from postman.

Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

You should configure your order of middleware components in the StartUp.Configure method as show below.

app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();