1

I have a multi-site and they are under 1 root domain and the default site is food.com and bread.food.com is the additional site. How can I share the user session data of food.com to bread.food.com. My goal is, when I login to food.com, I should also be logged in to bread.food.com.

Is there any SSO for multi-site.

Thank you.

1 Answer 1

2

If both sites share a common root domain, you can share cookies by using that root domain as the cookie domain for both sites. This way, a login stored in the cookie for one site will also apply to the other site. Session cookies will be shared as well.

To force Craft to use only the root domain for it's cookies, use the defaultCookieDomain directive.

// config/general.php

// mind the dot at the start
'defaultCookieDomain' => '.food.com',

There are some other settings that you should consider, depending on your setup and use-case those might lead to sessions not being applied correctly across both sites:

Is there any SSO for multi-site.

Not in the core, but there is this plugin in the store: SAML SSO Service Provider

1
  • 1
    Thank you it worked on me. I just added the 'defaultCookieDomain' => '.food.com', in the global settings '*' => [] Oct 29, 2021 at 3:16

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.