簡體   English   中英

使用考拉寶石來獲取Facebook朋友並不會返回所有朋友

[英]Fetching facebook friends using koala gem is not returning all the friends

我使用的代碼直接來自自述文件。

@graph = Koala::Facebook::API.new(oauth_access_token)
profile = @graph.get_object("me") // working perfectly fine..
friends = @graph.get_connections("me", "friends") // returning only my friends which are there in developer/admin list of the app.

我有什么想念的嗎?

PS:該應用尚未獲批准。

Facebook剛剛發布了它的API 2.0,該API更改了許多權限,並且friend_ *端點是其中之一,您可以在這里閱讀更多。 您的問題在鏈接中提到為

朋友列表現在僅返回還使用您的應用程序的朋友:通過/ me / friends端點返回的朋友列表現在僅限於已授權您的應用程序的朋友列表。

您只需添加此行...

@graph = Koala::Facebook::API.new(facebook_token)
# perfectly get facebook friends count :)
@friends = @graph.get_connection("me", "friends",api_version:"v2.0").raw_response["summary"]["total_count"]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM