kylemclaren
kylemclaren

Reputation: 768

Facebook Graph API searching for a person's profile picture

Perhaps I am misunderstanding the Graph API but the docs state that to search for a users profile picture, you do not need to include an access token in the request:

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

No when I run: http://graph.facebook.com/v2.2/me/picture?redirect=0&height=200&type=normal&width=200

I get the following in the response: An active access token must be used to query information about the current user.

Is this a bug that I can report or am I horribly misinterpreting the API?

Upvotes: 0

Views: 302

Answers (2)

Stéphane Bruckert
Stéphane Bruckert

Reputation: 22983

How do you want Facebook to guess who is "me"?

/me is a special endpoint that translates to the user ID of the person whose access token is being used to make the request.

Source: https://developers.facebook.com/docs/graph-api/quickstart/v2.2

An access token makes the link between a Facebook account and a graph request. So if you want to use "me", you must give an access token for Facebook to know that "me" is in fact you.

http://graph.facebook.com/v2.2/me?access_token=ACCESS_TOKEN

If you want to get your profile picture without an access token, just replace me by your USER_ID:

http://graph.facebook.com/v2.2/USER_ID

Upvotes: 1

kylemclaren
kylemclaren

Reputation: 768

Querying with a Facebook ID instead of "me" works. It seems that a token is required to get info about the current logged in user...

Upvotes: 1

Related Questions