I\'m trying to implement JWT authentication on my asp.net core webAPI as simply as possible.
I don\'t know what i\'m missing but it\'s always returning 401 even with the
Keep in mind that the UseAuthentication
, UseRouting
and UseAuthorization
middleware must in correct in order for the ASP framework properly inject the identity context to http request.
It should look like this: (.NET Core 3.1)
app.UseAuthentication();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});