Domanda

I want to show the profile picture using the graph api using the following link fpor example :

https://graph.facebook.com/me/picture?redirect=0&height=200&type=normal&width=200

I get the response :

{
   "error": {
      "message": "An active access token must be used to query information about the current user.",
      "type": "OAuthException",
      "code": 2500
   }
}

Where in the link they say

Because profile pictures are always public on Facebook, this call does not require any access token.

È stato utile?

Soluzione

The me in the URI is just a placeholder, you need to put an actual Facebook user-id in, like the title (/{user-id}/picture) of your linked page suggests.

For example:

https://graph.facebook.com/snoopdogg/picture?redirect=0&height=200&type=normal&width=200

...returns the following:

{
   "data": {
      "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/c11.0.433.433/s200x200/598452_10151897536239807_882122819_n.jpg",
      "width": 200,
      "height": 200,
      "is_silhouette": false
   }
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top