我无法使用 C# 使用 Facebook SDK 5.1 检索我的群组
我正在使用 Facebook SDK,并尝试使用 C# 来获取用户订阅的组。代码如下
JsonObject Groups = (JsonObject)client.Get("me/groups");
执行此代码后我得到一个空对象。这是我缺少的东西吗?
点赞 (JsonObject Groups = (JsonObject)client.Get("me/likes");
) 和朋友 (JsonObject Groups = (JsonObject)client.Get("me/朋友”);
) 工作正常。
I am using the Facebook SDK and I am trying with C# to get the groups the user is subscribed to. The code is as follows
JsonObject Groups = (JsonObject)client.Get("me/groups");
After this code executes I get an empty object. Is it something that I am missing?
The sale code for likes (JsonObject Groups = (JsonObject)client.Get("me/likes");
) and friends (JsonObject Groups = (JsonObject)client.Get("me/friends");
) is working ok.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要提示用户 user_groups 扩展权限。
You need to prompt the user for user_groups extended permission.
由于我遇到了同样的问题并且无法在任何地方找到帮助,因此我想我应该按照@DustyRoberts 的要求解释如何解决该问题。
如果您在请求
me/groups
或{user-id}/groups
时得到空对象,这是因为您缺少user_management_groups
权限(是 Graph API 版本 2.3 之前的user_groups
)。您可以通过在用户登录时添加
scope
参数来实现此目的。这是一个以逗号分隔的权限列表。您可以查看完整的权限列表此处 (v2.4)。有关检查权限的更多信息 此处 (v2.4)
我希望这对某人有帮助,因为这正是我使其工作所需的信息。
As I was having the same issue and couldn't find help anywhere, I thought I'd necro this with an explanation on how to solve the problem, as requested by @DustyRoberts.
If you get an empty object when requesting
me/groups
or{user-id}/groups
it's because you're lacking theuser_managed_groups
permission (wasuser_groups
prior to Graph API version 2.3).You can do this by adding the
scope
parameter when logging in the user. It's a comma seperated list of permissions. You can see a full list of permissions here (v2.4).More on checking for permissions here (v2.4)
I hope this helps someone cause it's exactly the information I needed to make it work.