Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 920
Corey Larson Avatar asked Mar 10 '11 07:03

Corey Larson


1 Answers

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.

like image 122
ifaour Avatar answered Sep 19 '22 10:09

ifaour