开发者

Extended Permissions on Facebook Graph API in PHP

I am trying to write an app using the most recent Facebook PHP SDK. However, any extended permissions I request are simply not requested, it always defaults to the basic request, and does not ask for any of the requested extended permissions.

Here is how I am requesting these permissions:

<?php 
require_once("facebook.php");

$app_id = "xxx";
$app_secret = "xxx";

$facebook = new Facebook(array(
    'appId' => $app_id,
    'secret' => $app_secret,
    'cookie' => true
));

if(is_null($facebook->getUser())){
    $params = array(‘scope’ => ‘user_status,publish_stream,user_photos’);       
    header("Location:{$facebook->getLoginUrl($params)}");
    exit;
}
?>

This file is included at the beginning of any page on which my app is embedded. Any ideas as to why I don开发者_开发问答't get the extended permissions I want?


Make sure you are using quotes '. It seems that you copied this example from a page or something.

if(is_null($facebook->getUser())){
    $params = array('req_perms' => 'user_status,publish_stream,user_photos');
    header("Location:{$facebook->getLoginUrl($params)}");
    exit;
}

UPDATE: use scope instead of req_perms with the new SDK.


You should pass the 'scope' parameter in a comma separated array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜