2012-04-18 24 views
1

Facebook做了些什麼改變了今天的javascript sdk認證?我用過FB Javascript SDK Authetication written by Mahmud Ahsan,今天之前一切都很好。現在它遇到了FB.logout()的問題。嘗試登錄his demo並單擊註銷按鈕。並嘗試再次按下此按鈕登錄。它不會迴應。 Firebug說:FB.logout()在沒有訪問令牌的情況下調用。也許有人知道如何將訪問令牌添加到FB.logout方法或..有鏈接到有關此更改的文檔?Facebook今天改變了JavaScript的sdk認證嗎?

我authetication:

window.fbAsyncInit = function() { 
FB.init({ appId: '*************', 
    status: true, 
    cookie: true, 
    channelUrl: '//localhost/website/channel.html', // Channel File 
    xfbml: true, 
    oauth: true}); 

// run once with current status and whenever the status changes 
FB.getLoginStatus(updateButton); 
FB.Event.subscribe('auth.statusChange', updateButton); 
}; 



var button,userInfo; 

function updateButton(response) { 
    button  = document.getElementById('fb-auth'); 
    userInfo  = document.getElementById('userInfo'); 

    if (response.authResponse){ 

    FB.api('/me', function(info) { 
    login(response, info); //function will just change text on the button.. 
    }); 

    button.onclick = function() { 
     FB.logout(function(response) { //here we are, FB.logout method =\ 
      logout(response); //function will just change text on the button.. 
     }); 
    }; 
} else { 

    button.innerHTML = 'Login'; 
    button.onclick = function() { 
     showLoader(true); 
     FB.login(function(response) { 
      if (response.authResponse) { 
       FB.api('/me', function(info) { 
        login(response, info); 
        });  
      } else { 
       //user cancelled login or did not grant authorization 

       alert('you are not logged in to facebook or have not granted this app basic permissins. please log in and grand basic permissins to user this application'); 
      } 
     }, {scope:'email,user_birthday,user_about_me'}); 
    } 
} 
} 
+0

沒有人知道嗎?有什麼建議麼? – Denis 2012-04-18 21:15:38

回答

0

解決了!問題出在FB.event.subscribe上。我只是改變了auth.statusChange給另一位聽衆 - auth.authResponseChange

相關問題