We are implementing the 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 in Sitecore context. This virtual user will be having the external domain roles as well, so from Sitecore we could able to assign security to any of the item which we want and we create our own custom personalization rules and use this virtual user properties to evaluate.

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? – Dan Sinclair Dec 13 '18 at 17:12

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, privacy policy and cookie policy

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