-2

我有一个 Facebook Javascript,它报告用户是否已登录,并且我想存储一个会话变量,以便我可以告诉我的网站用户已登录。这里是脚本。

 FB.getLoginStatus(function(response) {
   if (response.status === 'connected') {
   var uid = response.authResponse.userID; --> want to store this in a session variable
    var accessToken = response.authResponse.accessToken; --> want to store this in a session variable
 } else if (response.status === 'not_authorized') {
// the user is logged in to Facebook, 
// but has not authenticated your app
 } else {
  alert("your not connected");
}
});
 };
4

1 回答 1

3

您必须向服务器发出 AJAX 请求,传递accessToken,然后从服务器上的 ASP 代码将其存储在会话中。您不能直接从客户端 js 执行此操作(但您可以设置 cookie)。

于 2012-10-16T22:09:58.677 回答