Jump to content
DV-JF

Share session between different domains / TLD's

Recommended Posts

Hey all,

short question: I've setup a multi-language site using different domains for the different languages in site/ready.php I'm using following code:

 <?php
if($config->httpHost == "www.example.de") $user->language = $languages->get('default');
elseif ($config->httpHost == "www.example.si") $user->language = $languages->get('si');
elseif ($config->httpHost == "www.example.com") $user->language = $languages->get('en');?>

All domains are mapped into the same directory - this is working superfine 🙂

Now I have to take care about following use case: If a user is logged in and wants to change the language, the session have to be automatically transferred to the refering domain, so that the user having not to log in again.

IS this possible? Can you give me some hints on how to do this best with the current PW version?

Share this post


Link to post
Share on other sites

Since sessions are maintained by cookies and cookies are bound to domains the answer is no – you cannot share a session between domains.

What you can do is have only a single domain handle authentication, and all other domains fetch information from that service. See for example oauth or openid connect systems. That‘s rather complex though and not something available in processwire as is.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...