Jump to content

Single login to multiple domains


86Stang

Recommended Posts

I've got a slew of websites and I would like to merge their logins into just one.  So, if the user logs in at site1.com, he'll also be logged into site2.com, site3.com and all other sites on my list.

 

I'd appreciate some solid tips on how I can pull this off that DON'T include using OpenID or the like.

Link to comment
Share on other sites

What you would do, is when the user logs in, use a standard cookie on the primary website. This will serve as the login for this particular website. Now, below that login code, add a cURL call to the other website's login script, giving it the username and password through the postdata. Let that script use that information to set an identical cookie for that domain, and do this to as many domains as you wish. Do the same on the other website, and you'll have it sorted.

Link to comment
Share on other sites

I had to do something similar for work.  I have two separate web applications which are standalone.  However I needed to "embed" one app into the other.

 

Essentially the user logs into AppA.  They then click on a link to AppB.  AppB actually opens up in an iframe under AppA's navigation menu.  But then AppB presents it's login page.  So how did I solve this?

 

Well since I control both apps I control the login mechanism.  What I did was when I create the link to AppB I include the user's session_id() in the URL.  In AppB I check for the preset session id in $_GET and if it's there I set session_id() before calling session_start().

 

Essentially I'm allowing my users to hijack their own sessions.  I don't know if this will work for you, but it worked in my case.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.