简体   繁体   中英

How to check whether user is logged in on another site?

I have two separated applications (in PHP) - A and B with different domains. On application AI want to check whether user is logged in (right now) on application B. Ajax would do the work but CORS :/ Curl also won't work. Any other options?

The two servers need to keep some sort of a shared store of logged in users.

If the two websites are in different business domains (think Google and Amazon) then you would need to design api's on both websites to check whether the same user is logged in on the other website. One more thing to consider here, is what exactly defines your user. One site can use email, others can also use username, oauth token (google/facebook/github/etc.. auth), yet others can use phone number (especially in Asian countries). Therefore it can become quite a daunting task to keep track of everything.

If the websites share the business domain (think Gmail and google drive OR mobile and web), you would have a unified login system for all the websites and query it for the user data (dont forget to check if the cookies match!!)

There are many more details to discuss, but this should give you a basic idea. Cheers!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM