[英]Facebook Graph PHP FQL: Permissions to Friends Photos (New SDK)
Can't figure out how to add permissions to my access token to access friends photos. 无法弄清楚如何向我的访问令牌添加权限以访问朋友的照片。 I have: 我有:
//auth user
if(empty($code)) {
$dialog_url = 'https://www.facebook.com/dialog/oauth?client_id='
. $app_id . '&redirect_uri=' . urlencode($my_url)
. '&scope=friends_photos';
echo("<script>top.location.href='" . $dialog_url . "'</script>");
}
//get user access_token
$token_url = 'https://graph.facebook.com/oauth/access_token?client_id='
. $app_id . '&redirect_uri=' . urlencode($my_url)
. '&client_secret=' . $app_secret
. '&code=' . $code
. '&scope=friends_photos';
$access_token = file_get_contents($token_url);
$fql_query_url = 'https://graph.facebook.com/'
. '/fql?q=SELECT+pid,object_id+FROM+photo_tag+WHERE+subject=301179'
. '&' . $access_token;
$graph_url = "https://graph.facebook.com/me?access_token="
. $access_token;
$user = json_decode(file_get_contents($graph_url));
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);
echo '<pre>';
print_r("query results:");
print_r($fql_query_obj);
The query comes back empty. 查询返回空。
You should use scope
of OAuth dialog (see properties) to request permissions from user, later you just use his access_token
. 您应该使用OAuth对话框的 scope
(请参阅属性)来向用户请求权限,之后再使用他的access_token
。
$dialog_url = 'https://www.facebook.com/dialog/oauth?client_id='
. $app_id . '&redirect_uri=' . urlencode($my_url)
. '&scope=friends_photos';
BTW, there is no argument perms
for https://graph.facebook.com/oauth/access_token
顺便说一句, https://graph.facebook.com/oauth/access_token
perms
没有参数perms
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.