FB.logout() called without an access token. javascript sdk

我们两清 提交于 2019-11-30 04:13:06

Apparently this isn't possible, at least in no way I can figure out. Quick solution is call this function from a custom Log Out button:

function fbLogoutUser() {
    FB.getLoginStatus(function(response) {
        if (response && response.status === 'connected') {
            FB.logout(function(response) {
                document.location.reload();
            });
        }
    });
}

The page reload makes another request to Facebook which then sees the unauthorized state and removes the cookie from the browser which in turn invalidates the access_token. So this logs out the user from the site and from Facebook.

try this:

function fbLogoutUser() {
FB.getLoginStatus(function(response) {
    if (response && response.status === 'connected') {

        FB.logout(function(response) {
            document.location.reload();
        });
    } else if (response.status === 'not_authorized') 
        {
             FB.logout(function(response) {
            document.location.reload();
            });
        }
});}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!