Graph API won't return friends' religions

陌路散爱 提交于 2019-12-13 06:00:08

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/13686717/graph-api-wont-return-friends-religions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!