Facebook graph api 为什么FB.Event.subscribe不再检测I';你已经从facebook注销了吗?
如果我登录到facebook,testAPI()函数会按预期启动,但当我注销facebook并刷新初始化代码所在的页面时,什么也不会发生。我的控制台应该记录“未登录”或“未授权”,但它没有。我尝试过清除缓存,但不起作用Facebook graph api 为什么FB.Event.subscribe不再检测I';你已经从facebook注销了吗?,facebook-graph-api,facebook-javascript-sdk,Facebook Graph Api,Facebook Javascript Sdk,如果我登录到facebook,testAPI()函数会按预期启动,但当我注销facebook并刷新初始化代码所在的页面时,什么也不会发生。我的控制台应该记录“未登录”或“未授权”,但它没有。我尝试过清除缓存,但不起作用 FB.Event.subscribe('auth.authResponseChange', function(response) { //this works testAPI(); } else if (response.status ===
FB.Event.subscribe('auth.authResponseChange', function(response) {
//this works
testAPI();
} else if (response.status === 'not_authorized') {
console.log("not authorized");
} else {
console.log("not logged in");
}
});
var testAPI = function() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Good to see you, ' + response.name + '.');
});
};
auth.authResponseChange
仅在状态实际更改时触发,在您的情况下,它永远不会更改
您想要的是使用FB.getLoginStatus