Ad

Facebook Access To Users Photos Using My App Token

Having problems gaining access to a users photo's from my Facebook app.

I request the apps token at runtime using: (replacing the values in [] brackets with actual values.

https://graph.facebook.com/oauth/access_token?client_id=[clientid]&client_secret=[clientsecret]&grant_type=client_credentials

I then try to access a users photo using that access token, ie:

https://graph.facebook.com/fql?q=SELECT pid, src_big, src_small FROM photo WHERE pid IN('4313357036026642248','4313357036026642249','4313357036026642250','4313357036026642251','4313357036026642252','4313357036026642253','4313357036026642254')

The user has authenticated themselves with my app and accepted the USER_PHOTO permissions.

However I get 0 results back. I do get results back when I use that users access token rather than the app token.

I have proven this issue on the graph explorer: https://developers.facebook.com/tools/explorer?method=GET&path=1004281695

Anyone got any ideas why an app that has been granted access to a user photos cannot get those photos using the app access token ?

Thanks in advance, Rhys

Ad

Answer

Because with very few exceptions, you can only access a user's data using a valid access token for that user (or one of their friends, depending on the privacy of the object in question).

In this case, use the user's access token, the app access token is for acting on behalf of the app and shouldn't really be used for user-specific calls, as it won't be able to see non-public information except with very limited circumstances

Ad
source: stackoverflow.com
Ad