如何确定用户是否已通过facebook javascript sdk确认或取消登录

如何确定用户是否已通过facebook javascript sdk确认或取消登录,facebook,web,login,facebook-javascript-sdk,Facebook,Web,Login,Facebook Javascript Sdk,我通过facebook的Javascript SDK将用户登录到一个网站。在用户单击“通过fb登录”按钮后,我想根据用户在facebook确认中单击“确定”还是“取消”生成不同的响应。下面是他们单击fb按钮时我使用的代码 $("#fb").click(function() { FB.login(function(response){ FB.api('/me',function(response){ // I believe the test to

我通过facebook的Javascript SDK将用户登录到一个网站。在用户单击“通过fb登录”按钮后,我想根据用户在facebook确认中单击“确定”还是“取消”生成不同的响应。下面是他们单击fb按钮时我使用的代码

$("#fb").click(function() {
    FB.login(function(response){
        FB.api('/me',function(response){

            // I believe the test to see if they are logged in or not should go here

        });//FB.api
    },{scope:'publish_actions, email, user_likes, user_location'});
});
任何建议都将不胜感激。谢谢

根据facebook的:

这对我有用。希望它能帮助别人

FB.getLoginStatus(function(response) {
  if (response.status === 'connected') {
    // the user is logged in and has authenticated your
    // app, and response.authResponse supplies
    // the user's ID, a valid access token, a signed
    // request, and the time the access token 
    // and signed request each expire
    alert('a');
  } else if (response.status === 'not_authorized') {
    // the user is logged in to Facebook, 
    // but has not authenticated your app
    alert('b');
  } else {
    // the user isn't logged in to Facebook.
    alert('c');
  }
 });