Reputation: 551
I have researched this problem but it is mostly from people who want to login to sites like google or facebook with a single click.
Here is my problem:
I have two sites. Both sites have their own login pages ( ie login.php). Both sites have usernames in common. I have control over both sites ( I can change their code). I want to log in to server B when the user clicks on a link on server A.
I have thought about making one server send a post request to the other but then the other server will create a session with this server instead of with the client's computer.
What I wanted to do was create a proxy login page that communicates with the current login script.
If possible I need this done in php.
Any Suggestions/Ideas/Links?
Thank you
Upvotes: 2
Views: 811
Reputation: 4002
You should take a look at what Wikimedia does with Single User Login.
The way the system works is when you log into a project, a token is created and stored in a shared database. That token is then put into the login success page, via an image. For example, this HTML will cause a request to the meta project:
<img src="http://meta.wikimedia.org/wiki/Special:AutoLogin?token=TOKENTOKENTOKEN" alt="meta.wikimedia.org" title="meta.wikimedia.org">
The user then makes a request with that token attached to the image, which causes the resulting project to authenticate that user and give the user cookies for that domain.
Upvotes: 1