Sitecore user login/authentication is not maintained between pages

28 views Asked by At

Alright I am encountering a truely strange issue. I am currently working through an upgrade from sitecore 9.1 to a version of sitecore 10. (but this issue has occured in the current version I am working on but resolves after computer restarts and browser cashe clears)

The issue:

I am attemting to log a user into a sitecore hosted site, but the User Authentication does not persist after the inital login method is called and the page resolves after the login redirect.

I am using the Sitecore method:

AuthenticationManager.Login(username, password, bool)

After this call in my controller the bool that the method returns is true. I am also able to validate user information from IsAuthenticated methods:

Sitecore.Context.User.IsAuthenticated - returns true
Sitecore.Context.User - contains proper user information

I redirect off the login page after validation of the user.

After my redirect the user is no longer authenticated and Sitecore.Context.User is now anonymus.

I have not encountered this issue in any places other than my Local Development instance. But for the purposes of the upgrade this must function to move forward. In the current sitecore 9.1 this issue is transient and after clearing the browser cashe, opening a new incognito window, or doing a computer restart the problem disappears. This is a persistant and constant issue in the sitecore 10 version I am testing.

I am not aware of what would cause the sitecore context to loose that user authentication with just 1 page change. I am unable to pinpoint a cookie or some other persistant item that is (or is not) maintaining that user information.

Can someone point me in the direction of a potential solution?

EDIT : Minor breakthrough in information but no solutions yet.

It seems that setting up a SSL certificate for my local development instance allows me to properly maintain a user as logged in. This would explain why I have never encountered this issue in QA or production as all sites require an SSL certificate.

In testing, sites without the local SSL cert still persist the error where sites that I have added SSL cert operate as expected.

it is a small update but no closer to explaining the issue.

Sitecore authenticationManager.login not maintaining user information after login page.

0

There are 0 answers