0

i want to create a php web app with REST API.where user logins on the Server/Main site. problem is that how to get current logged in user on a php client.i am using CURL at client to get data from server. if i store a user cookie in browser when user logins on my site, then client can't access them because CURL doesn't send cookies when requesting. if i use CURL COOKIEJAR or COOKIEFILE, they will not safe since a client can store cookies data and use them for access user's account. i want my API to be like Facebook API. how FB API knows who is currently logged in? i only want to know is there any way to get the currently logged in user on server site.either by cookie or by session. please someone help me thanks

4

1 回答 1

0

Facebook API 和 Twitter API 使用 Oauth http://oauth.net/

Oauth 对于中间登录的人来说很棒。Oauth 将用户与最终​​服务器连接起来,并在中间的服务器上提供一个令牌,该令牌是知道谁登录的方式。

https://developers.facebook.com/docs/reference/dialogs/oauth/

于 2013-06-09T15:21:46.330 回答