Return 401 Unauthorized from ASP.NET Core API

added by Michal Dymel
7/7/2016 4:54:42 PM

1 Kicks, 1794 Views

Another quick tip on working with ASP.NET Core API today. When you use ASP.NET Core Identity framework for user authentication, you probably use [Authorize] attribute in your controllers too. This post tells you how to return 301 Unauthorized status code for not logged in users in your JSON API.