2

Parent Site Url: www.site1.com

Sub Domain Url: www.abc.site1.com

We have the requirement like create the sub domain(abc.site1.com) in separate instance and use the login & registration functionality from parent site(site1.com),can any one suggest the best approach in sitecore.

Note that, subdomain website doesn't have the login & registration forms, but have the these two buttons, once user clicks the login button form the sub domain, it should redirect to parent website, after successful login it should redirect to current website(sub domain).

Thanks in advance.

6
  • Do you need logic that if user logged in to www.site1.com he also should be logged in on www.abc.site1.com?
    – x3mxray
    Commented Jun 24, 2019 at 14:37
  • When you say separate instance, do you mean a whole other IIS site? That will make it difficult because the sessions will be different. That also requires you to have another Sitecore license for the other instance.
    – Chris Auer
    Commented Jun 24, 2019 at 23:40
  • @x3mxray thanks for your response, yes we need logic for "user logged in to www.site1.com he also should be logged in on www.abc.site1.com", note that we have separate instances for both sites.
    – Suresh R
    Commented Jun 25, 2019 at 4:31
  • 1
    All that you need is set Auth cookie domain on your parent site to CookieDomain = ".site1.com". Check these links with similar question: community.sitecore.net/developers/f/8/t/1241 and sitecore.stackexchange.com/questions/15872/…
    – x3mxray
    Commented Jun 25, 2019 at 7:27
  • Thanks @x3mxray for your suggestion, will go with your suggestion.
    – Suresh R
    Commented Jun 25, 2019 at 7:56

2 Answers 2

0

So it's not the requirement to achieve single-sign-on for site1.com and abc.site1.com. It seems you only want to use same login & registration functionality in multiple sites?

In case both sites are under same Sitecore instance then you can share login & registration renderings among the sites.

In case both sites are under different Sitecore instance and you have component based architecture like helix then you can reuse feature projects (for login & registration renderings) in multiple instances.

3
  • Hi S.Kazmi, thanks for your response, sub domain web site doesn't have the login & registration forms, but have the buttons, once user click the login button it should redirect to parent site, after successful login return back to sub domain.
    – Suresh R
    Commented Jun 25, 2019 at 4:36
  • 1
    So in this case, once user is authenticate in parent site, you can redirect to subsite and simply use token based authentication to allow user to access the subsite.
    – S.Kazmi
    Commented Jun 25, 2019 at 4:55
  • Thanks S.Kazmi for your suggestion.
    – Suresh R
    Commented Jun 25, 2019 at 5:29
0

You can set the httpcookies inside Web.config with the domain of the parent site as below:

<httpCookies requireSSL="false" domain="subdomain.com" />

This will make authentication cookie valid for both the parent and subdomain sites. You can find more details here:

https://sitecorefoundation.in/sharing-cookies-with-sitecore-owin-authentication/

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.