2

we are working on custom personlization rules with user data available outside sitecore. App is developed in jss in ssr mode. With sitecore login setting up virtual user context when user logged in to jss app, which can be accessed in later layout service calls. Sitecore version: 9.2

User virtualUser = ServiceHelper.BuildVirtualUser(userId);
virtualUser.Profile.Save();
AuthenticationManager.Login(virtualUser);
CustomRuleContext context = new CustomRuleContext()
                {
                    AttributeListValues = userAttributes
                };
Sitecore.Context.User.Profile.Context.Add("RuleContext", context);

During custom personlization rule execution, trying to fetch user context from logged in user profile, but it is not working. It used to in previous POC done an year ago.

CustomRuleContext currentContext = Sitecore.Context.User.Profile.Context["RuleContext"] as CustomRuleContext

During login authcookie is set at domain level. Both application front end react app and sitecore running on same domain, so login auth cookie is accessible for sitecore during the call. Anyone face similar issue while accessing logged in user profile context.

0

Your Answer

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