ASP.NET Core 2 Solved: Authorization was successful for user: (null).

less than 1 minute read

While I was migrating an ASP.NET Core 1 project to version 2 my authentication code stopped working. After some investigation I kept running across this info message in my application logs which seemed unusual:

info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[1]
Authorization was successful for user: (null).

The Fix

Turns out this is a simple issue to fix. Just make sure that in the Configure() _method in the _Startup class contains a call to app.UseAuthentication() before the call to app.UseMvc() for example:

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)


With this method updated to include the Authentication middleware, the issue should be resolved.