Graph API不会返回朋友的宗教 [英] Graph API won't return friends' religions

查看:104
本文介绍了Graph API不会返回朋友的宗教的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个屏幕,用户可以选择Facebook的朋友。提交表单后,我正在从Facebook请求一个特定字段的个人资料(例如: https://graph.facebook.com/some_id?fields=id,name,religion&access_token=xxx )。



当请求我自己的个人资料数据与请求中的宗教字段,我看到结果正确包含的值。当我要求我的朋友的个人资料数据时,即使在直接查看他们的个人资料页面时也可以看到回复。



我确定我在进行此呼叫(并使用更新的访问令牌)之前,我要求 user_religion_politics friends_religion_politics 权限。发生了什么?

解决方案

创建两个测试用户帐户后,为了访问,似乎有两件事情之一朋友的宗教信仰通过Graph API:


  1. 朋友必须让他们的宗教信息公开。例如,将其设置为朋友之友不足以让API由于某种原因被检索,无论我们的友谊如何。


  2. 朋友必须授权该应用的 friends_religion_politics 权限。通过授权我自己的帐户,我不告诉Facebook我想允许访问我的朋友的宗教信息。相反,我告诉Facebook,我想让我自己的宗教信息通过Graph API请求的其他朋友。


第二点是一个非常重要的区别,我希望在文档中明确说明。不幸的是,这个许可对于我现在的需求基本上没有价值。


I have a screen where users can select Facebook friends. After submitting the form, I'm requesting a profile object from Facebook with specific fields (e.g.: https://graph.facebook.com/some_id?fields=id,name,religion&access_token=xxx).

When I request my own profile data with the religion field in the request, I'm seeing the value properly included with the result. When I request my friends' profile data, the response is not including their religion even though I can see it when viewing their profile page directly.

I have made sure that I am requesting both user_religion_politics and friends_religion_politics permissions prior to making this call (and am using the updated access token). What's going on?

解决方案

After creating two test user accounts, it appears that one of two things must be true in order to access a friend's religion via the Graph API:

  1. The friend must make their religion info "Public". Setting it to "Friends of Friends" for example is not enough to let it be retrieved by the API for some reason, regardless of our friendship.

  2. The friend must authorize the app's friends_religion_politics permission. By authorizing that permission on my own account, I am not telling Facebook that I want to allow access to my friend's religion info. Instead, I am telling Facebook that I want to allow my own religion info for other friends who are requesting it via Graph API.

The second point is a very important distinction, and I wish it were spelled out in the documentation as such. The permission is essentially worthless for my needs as is stands now, unfortunately.

这篇关于Graph API不会返回朋友的宗教的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆