1

Facebook 今天在 javascript sdk authetication 中有什么改变吗?在今天之前,我使用了 Mahmud Ahsan 编写的FB Javascript SDK Authetication ,一切都很好。现在它与 FB.logout() 有问题。尝试登录他的演示,然后单击注销按钮。并尝试再次按下此按钮登录。它不会响应。Firebug 说:FB.logout() 在没有访问令牌的情况下调用。也许有人知道如何将访问令牌添加到 FB.logout 方法或.. 有关于此更改的文档的链接?

我的认证:

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'});   
    }
}
}
4

1 回答 1

0

解决了!问题出在 FB.event.subscribe 上。我只是将auth.statusChange更改为另一个侦听器 - auth.authResponseChange

于 2012-04-19T14:46:59.113 回答