问题
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:
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.
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