2

(I'm aware of this question, but it's outdated to the point of no longer working, so asking again.)

With the Facebook API it used to be that all profile pictures were considered public, and you could get one for anyone without any access tokens like this: https://graph.facebook.com/4/picture

Now in 2020 it seems that it only works for public images like Zuck there. I have a tool for Facebook page admins that shows a list of people who liked page posts, but when I try to show user pictures in the list they all now come up blank because "This object does not exist or does not support this action".

The docs now say "This document refers to a feature that was removed after Graph API v3.2". But I could not find any more information about this deprecation. Is it now just impossible to show the picture of a user without having a user access token, or has the way to call it just changed?

Bemmu
  • 17,849
  • 16
  • 76
  • 93
  • In general, this should still work. (Those “feature was removed with version x.y” notices in the docs aren’t always correct, from my experience, FB has a tendency to mess those up with new API version releases.) I just tested it, still works for my profile pic - when I use it a `src` of an image element, even in a browser I am not currently logged into Facebook in. – CBroe Jun 15 '20 at 06:51
  • Guess it might be a problem with what kind of user ID you have here? I tested it with the app-scoped uid it get for my profile with one of my apps - I am not sure if this is supposed to work with page-scoped user ids though. Depending on how you got your list of likers, I guess you might be dealing with the latter. – CBroe Jun 15 '20 at 06:53
  • @CBroe I have a page access token which I use to get /me/feed for that page, which includes people who liked and commented on posts. I get UIDs from there and it used to work to show their pictures by //picture, but no longer works. – Bemmu Jun 15 '20 at 09:25
  • OK it looks like it wasn't necessary before to include an access token for page-scoped UIDs, but now it is. – Bemmu Jun 15 '20 at 09:30

1 Answers1

1

The feature has not been removed, but now for users that don't have their profiles set as public, you need to provide an access token.

For instance suppose you use the Page API to list all the people who commented on a post. Previously you could show the profile pics of commenters by just linking to https://graph.facebook.com/<UID>/picture. However now you need an access token for that Page, and to then access the pic as https://graph.facebook.com/<UID>/picture?access_token=<TOKEN HERE>.

I have not tested this with apps, but I would assume that also to get the profile pics of app users based on their app-scoped UID, you'd need to include an access token there as well.

Bemmu
  • 17,849
  • 16
  • 76
  • 93
  • Does this access token expire? It seems like it does... I saved user pic url with access token, and now it is a 404 a month later. – giorgio79 Jun 10 '21 at 19:20
  • And yes, access tokens live max for 60 days https://developers.facebook.com/docs/facebook-login/access-tokens#termtokens – giorgio79 Jun 10 '21 at 19:23
  • @giorgio79 Also see https://developers.facebook.com/docs/facebook-login/access-tokens/refreshing/ to extend a token – Bemmu Jun 14 '21 at 14:15