开发者

php auto login from one site to another

开发者 https://www.devze.com 2022-12-21 00:23 出处:网络
i have 2 different websites. i want a feature that when a user lo开发者_运维技巧gs in to site A then he should be automatically logged in to site B. please give me some concepts for that. (eg:- when a

i have 2 different websites. i want a feature that when a user lo开发者_运维技巧gs in to site A then he should be automatically logged in to site B. please give me some concepts for that. (eg:- when anyone logs into gmail, he is automatically logged into orkut)


Start using openID http://openid.net/


If you control both websites, then you can ask website1 if the user is logged in, and if he is, log him in on website2. Login state is usually stored in cookies, but website2 cannot read website1's cookie, so website2 cannot see if the user is logged into website1 without asking website1.


If both sites are under your control, you can have website1 tag any links pointing to website2 with an ecrypted token of some sort. The exact contents would be up to you, but whenever a page is requested from website2 with that token set, it can be decrypted and contain whatever information is needed to say that "hey, this user logged in successfully on website1, consider them accepted on website2"

0

精彩评论

暂无评论...
验证码 换一张
取 消