We are implementing JSS in headless SSR mode, we would like to know a way to virtually login to Sitecore from our JSS components. I mean the user authentication will happen with an external system from JSS component, once the user is authenticated we would like to create a virtual user/session in Sitecore context. This virtual user will be having an external domain roles as well. With this we could able to assign security to any of the item in Sitecore, we create our own custom personalization rules using custom properties, while rule evaluation we use virtual user properties which we set during login.

Any suggestions will really help..


  • 1
    What do you mean "virtually login"? Using virtual users? Authenticating without asking the user to enter a username/password combo? Something else? Commented Dec 13, 2018 at 17:12

1 Answer 1


Created a custom controller similar to the one provided by Sitecore /sitecore/api/ssc/auth/login inherits from the ServicesApiController. Created our own Login method, wher we invoked the Sitecore's Login method [one of the overloads can be invoked without a password]. Something like the below,

Sitecore.Security.Accounts.User user =  Sitecore.Security.Authentication.AuthenticationManager.BuildVirtualUser(@"domain\" + id, true);
        if (user != null)
            Sitecore.Security.UserProfile profile = user.Profile;
            profile.FullName = "User Name";
            foreach (var role in "ROLELIST")
                if (Sitecore.Security.Accounts.Role.Exists(role))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.