Skip to content

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

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:

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:

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




Published in.NET coreC#

Be First to Comment

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.