如何使用 Javascript SDK 删除应用程序请求
我有以下 Javascript 代码:
function RemoveRequest( requestToRemove )
{
FB.api( requestToRemove, 'delete', function(response) {
console.log(response);
});
}
这似乎是我看到人们使用的标准方法。不幸的是,我收到一个错误。 我从中得到的响应对象声明如下: “必须指定应用程序请求收件人:必须通过用户签名的访问令牌或完全指定的应用程序请求 ID 来指定此应用程序请求的收件人。”
所以,我尝试使用 requestid_facebookid 代替......但没有运气。我尝试通过传递我的访问令牌
FB.api(requestToRemove, 'delete', {access_token:accessToken}, function(response) {
console.log(response);
});
两者都给出了相同的错误。
任何提示将不胜感激。
编辑:为了清楚起见,我得到的 authToken 来自 getLoginStatus 的 response.authResponse.accessToken 。
I've got the following Javascript code:
function RemoveRequest( requestToRemove )
{
FB.api( requestToRemove, 'delete', function(response) {
console.log(response);
});
}
This seems to be the standard approach I see people using. Unfortunately, I get an error.
The response object I get from this states the following:
"App Request Recipient Must Be Specified: The recipient for this app request must be specified through a user-signed access token or the fully specified app request ID."
So, I try using requestid_facebookid instead... no luck. I try passing in my access token via
FB.api(requestToRemove, 'delete', {access_token:accessToken}, function(response) {
console.log(response);
});
Both give me the same error.
Any tips would be greatly appreciated.
Edit: Just for clarity's sake, the authToken I am getting is from response.authResponse.accessToken from getLoginStatus.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我仍然不确定如何删除这些请求。不过,我确实想出了一个使用图形 api 的解决方法。
新代码如下:
发送应用程序请求
并删除它
这似乎将请求的类型从用户应用程序请求更改为应用程序请求。徽标从我的个人资料图片更改为应用程序图标。我能够从图形 API 和 Facebook 网页删除这些请求。如果有人有任何想法,我仍然想知道如何删除用户应用程序请求。
I'm still not sure how to delete these requests. However, I did come up with a workaround with the graph api.
New code is as follows:
Sending the app request
And deleting it
This seemed to change the type of the request from a user app request to an app request. The logo changed from my profile picture to the app icon. I was able to delete these requests both from the graph api and through facebooks webpage. I'd still love to know how to delete the user app requests if anyone has any ideas.
我在网上搜索了6个小时,最后自己解决了。
发送请求:
2 种可能的回调方式:
选项 1 使用 Facebook.api
选项 2:使用 Facebook.deleteObject
回调函数进行删除:
I lost 6 hours searching online, at the end I figured it out by myself.
send request:
2 possible way for the callback:
Option 1 with Facebook.api
option 2: with Facebook.deleteObject
callback function for the delete:
如果您想使用 Javascript SDK 删除当前登录用户的所有 Facebook 待处理应用程序请求,您可以执行以下操作:
If you want to remove all the Facebook pending app requests of the current logged user with the Javascript SDK you can do the following: