Android: How to get facebook user image using access_token

半城伤御伤魂 提交于 2019-12-03 08:53:46

Finally, after a long search, i got the way to access login user's image by using only access_token https://graph.facebook.com/me/picture?access_token=<your_access_token_here>
thanks to @Jess for your valuable answer!

You don't need an access token to retrieve a user's profile image. Just issue a http GET request on http://graph.facebook.com/YOUR_ID_HERE/picture, so for example:

http://graph.facebook.com/4/picture gets you user id 4's picture, no access token needed.

EDIT:

To fetch the picture without knowing their fb id but with their access token, just execute a GET request on /me?fields=name,picture and you will receive a response with the URL to their profile picture.

See Graph API Tool example:

https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Dname%2Cpicture

So after messing around with the facebook graph apis for a bit, I have found that you can get the profile pic in two ways:

  1. Use this as the profile pic url by substituting the user id: https://graph.facebook.com/USER_ID/picture?return_ssl_resources=1

  2. Using the access token: https://graph.facebook.com/me/picture?access_token=ACCESS_TOKEN

Hope this is helpful.

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