Facebook 删除评论 API 问题 (#200) 应用程序没有足够的权限执行删除评论的操作
Facebook Delete Comment API problems (#200) App does not have sufficient permission for this action for remove comments
我以我是 facebook 页面管理员的用户身份登录。我写 api 通过使用此方法删除帖子中的垃圾评论。
$scope.deleteComments = function (commentID) {
if (confirm("Confirm Delete Comments")) {
FB.api(
"/" + commentID,
"DELETE",
function (response) {
console.log(response, commentID);
if (response && !response.error) {
/* handle the result */
}
}
);
}
};
我遵循了“https://developers.facebook.com/docs/graph-api/reference/v2.5/comment”的指示。在我使用 Facebook API 之前,我已授予此代码的许可。
$scope.triggerLogin = function () {
FB.login(function () {
$scope.checkLoginState();
}, {
scope: "public_profile, publish_pages, manage_pages"
});
};
因此,当我使用 deleteComments() 函数时,我会像这样从 facebook 获取错误对象
- error: Object
- code: 200
- message: "(#200) App does not have sufficient permission for this action"
- type: "OAuthException"
有谁知道如何解决这个问题,谢谢。
您很可能没有使用页面令牌,现在看起来您正在使用用户令牌。您必须使用页面令牌来删除评论。使用 /me/accounts
端点(或特定页面的 /page-id?fields=access_token
)生成页面令牌,并在 API 调用中使用它:
FB.api(
'/' + commentID,
'DELETE',
{access_token: 'your-page-token'},
function (response) {
console.log(response, commentID);
if (response && !response.error) {
/* handle the result */
}
}
);
有关令牌及其生成方式的更多信息:
我以我是 facebook 页面管理员的用户身份登录。我写 api 通过使用此方法删除帖子中的垃圾评论。
$scope.deleteComments = function (commentID) {
if (confirm("Confirm Delete Comments")) {
FB.api(
"/" + commentID,
"DELETE",
function (response) {
console.log(response, commentID);
if (response && !response.error) {
/* handle the result */
}
}
);
}
};
我遵循了“https://developers.facebook.com/docs/graph-api/reference/v2.5/comment”的指示。在我使用 Facebook API 之前,我已授予此代码的许可。
$scope.triggerLogin = function () {
FB.login(function () {
$scope.checkLoginState();
}, {
scope: "public_profile, publish_pages, manage_pages"
});
};
因此,当我使用 deleteComments() 函数时,我会像这样从 facebook 获取错误对象
- error: Object
- code: 200
- message: "(#200) App does not have sufficient permission for this action"
- type: "OAuthException"
有谁知道如何解决这个问题,谢谢。
您很可能没有使用页面令牌,现在看起来您正在使用用户令牌。您必须使用页面令牌来删除评论。使用 /me/accounts
端点(或特定页面的 /page-id?fields=access_token
)生成页面令牌,并在 API 调用中使用它:
FB.api(
'/' + commentID,
'DELETE',
{access_token: 'your-page-token'},
function (response) {
console.log(response, commentID);
if (response && !response.error) {
/* handle the result */
}
}
);
有关令牌及其生成方式的更多信息: