所以我的问题是当我使用facebook api时,一切似乎工作正常,直到我撤销应用程序的权限。一旦我这样做,api就会停止工作。这是代码:
if (socialMediaType == "facebook") {
//it always gets to this location even after the revoke happens
FB.getLoginStatus(function (response) {
//gets in here fine on page load and other instances,
//but if you hit permissions delete it never gets here
if (response.status === 'connected') {
if (!ConnectButtonClicked) {
FB.api("/me/permissions", "delete", $scope.fbRevokeCallBack);
} else { /*code here works fine*/ }
} else {
$scope.facebookLogin();
}
});
}
我是否因撤销对应用的权限而错误地做了什么?
以下是回电:
scope.fbRevokeCallBack = function (Data) {
console.log('auth revoke', Data);
// check for a valid response
if (!Data || Data.error) {
$scope.$apply(function () {
$scope.fb.connectionError = true;
$scope.socialError = "error";
});
return;
}
if (Data) {
console.log("Success");
};
}
成功被击中并且应用程序按预期被撤销,但当您重新连接到Facebook时,api什么都不做。在网络选项卡中找不到任何呼叫,并且永远不会回击回叫。
一些信息: 这是使用Facebook JSSDK 这在AngularJS中使用
答案 0 :(得分:0)
$ scope。$ apply()帮助吗?
if (socialMediaType == "facebook") {
//it always gets to this location even after the revoke happens
FB.getLoginStatus(function (response) {
//gets in here fine on page load and other instances,
//but if you hit permissions delete it never gets here
if (response.status === 'connected') {
if (!ConnectButtonClicked) {
FB.api("/me/permissions", "delete", $scope.fbRevokeCallBack);
} else { /*code here works fine*/ }
} else {
$scope.facebookLogin();
}
$scope.$apply();
});
}