Authentication not working

hi there,

I recently installed the studio IDE and ran through the tutorial to add a db and security to the app. My user profiles and roles are being stored in a MySql db.

I was able to create new roles and new users, but when I try to login I am successfully redirected however the mainLayout thinks I am not authenticated.

When I debug my generated AccountController, I can see that signInManager.PasswordSignInAsync is successful and my user is recognized. But, inside SecurityService, my Principal is always null.
As a result, @Security.IsAuthenticated() is always false.

Any help would be very much appreciated.

Hi @tbhireoutput,

This could happen if the dotnet development certificate is not trusted or not installed. Check here for more information: Enforce HTTPS in ASP.NET Core | Microsoft Learn

hi @korchev, thanks for your response.

Based on what I am seeing, my certificates are trusted and installed. I am still seeing the same issue unfortunately.

Not sure what could be causing such problems. You can try debugging the code to see what AuthenticationState contains in SecurityService.

by that do you mean checking what is returned by GetAuthenticationStateAsync?