is it possible to get access token without user authorization with PHP? I need user access token to get photos from Facebook fan page:
$photoQuery = urlencode('SELECT pid,src_big,src_small,caption,link,position FROM photo WHERE aid = "'.$albumId.'"');
$photoFQL = 'https://api.facebook.com/method/fql.query?query='.$photoQuery .'&access_token='.$access_token.'&format=xml';
$photoResults = file_get_contents($photoFQL);
With user authorization it worked perfectly well, but without it I don’t know how to get right access token. I’ve tried to get it like this:
$url = 'https://graph.facebook.com/oauth/access_token?client_id=xxx&client_secret=xxx&grant_type=client_credentials';
$x = curl_setopt($ch, CURLOPT_URL, $url);
$accessToken = curl_exec($ch);
curl_close($ch);
So actually I get the access token, but its not working with photos retrieve. Maybe the problem is that Facebook fan page is alcohol related so its not possible to get correct token without authorization or maybe Im doing something wrong.
So any ideas?
If a Facebook page has any user restrictions like alcohol, age, or country, you can only get that page’s posts using a user
access_tokenthat meets the set criteria.This is to prevent a user who shouldn’t be seeing that page’s information from gaining access to it through an app.