Is it possible to check (using PHP or Javascript) if a user is logged into his/her accou开发者_Go百科nt? I need the name, email and photo.
It is not possible unless you're twitter.com
, cookies are only passed to the domain they're for (or a parent domain, depending on how they're set), for security reasons.
Imagine if you could do this, do you want any web site you visiting knowing your an SO member, your gmail login, your....you see my point, it would be a huge privacy breach, as well as a security one since you could steal a user's session on many sites.
You can't do it by reading the cookies. Each cookie is tied to a domain, and can only be read from that domain.
You can, however, use Twitter's REST API to get information about a user. Combining this with OAuth should let you make sure that the user actually owns that account, and let the user log in if they need to. Refer to Twitter's documentation for details.
精彩评论