How to get the picture of Facebook User using Koala gem?

前端 未结 6 1254
伪装坚强ぢ
伪装坚强ぢ 2021-02-09 17:14

I am trying to fetch the picture of a Facebook user\'s friends using their facebook ids, but using the following code returns nil instead of the picture url...

The code

6条回答
  •  一向
    一向 (楼主)
    2021-02-09 18:17

    Use the access token you've received from oauth

    graph = Koala::Facebook::GraphAPI.new(access_token)
    profile_path = graph.get_picture(uid)
    

    To get the path, then to display it

    <%= image_tag profile_path %>
    

    This works for me, and should for you..

提交回复
热议问题