How to use FB.api('/me/picture') to get profile image

后端 未结 5 1203
你的背包
你的背包 2020-12-29 14:43

This is a very silly question. I\'m a beginner with facebook Javascript SDK. So I\'m trying to make a the user\'s profile image to show I used this code

FB.         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 14:59

    /me/picture (or /{user id}/picture) returns an HTTP 301 redirect to the image location so you can embed it directly into an

    If you want to retrieve the URL and use it yourself you need to specifically request it as a field, via :

     /{user id}?fields=picture
    

    or

     /me/?fields=picture
    

    You can include other fields too, but I'm assuming you just want the photo right now.

提交回复
热议问题