You do not need a separate CookieAuthentication middleware when you are using ASPNET identity. UseIdentity() will do that for you and generate a cookie . You can set the “cookie options” in the AddIdentity block of the application like so: services.
Read moreHow do I use cookie authentication in .NET Core?
Add cookie authentication
Read more