email is not coming in facebook php sdk - php

This is login system in facebook php sdk,what happens it asks for basic permissions then when a user permits through his facebook account it stores his facebook id and email and then shows this fbid and email in the index through session ,but it is not working properly though fbid comes nut email is not coming it is showing blank
<?php
session_start();
require_once("autoload.php");
require_once('Facebook/FacebookSession.php');
require_once('Facebook/FacebookRedirectLoginHelper.php');
require_once('Facebook/FacebookRequest.php');
require_once('Facebook/FacebookResponse.php');
require_once('Facebook/FacebookSDKException.php');
require_once('Facebook/FacebookRequestException.php');
require_once('Facebook/FacebookAuthorizationException.php');
require_once('Facebook/GraphObject.php');
require_once('Facebook/GraphUser.php');
require_once('Facebook/GraphSessionInfo.php');
require_once( 'Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'Facebook/HttpClients/FacebookCurl.php' );
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'Facebook/Entities/AccessToken.php' );
require_once( 'Facebook/Entities/SignedRequest.php' );
use Facebook\FacebookSession; use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest; use Facebook\FacebookResponse;
use Facebook\FacebookSDKException; use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException; use Facebook\GraphObject;
// init app with app id and secret
FacebookSession::setDefaultApplication( ' 332325566667346','30adsfsdf7sdf87df6s7df87sdf76dsfd16' );
// login helper with redirect_uri
$helper = new FacebookRedirectLoginHelper('http://localhost/bb/fbconfig.php' );
try {
$session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
// When Facebook returns an error
} catch( Exception $ex ) {
}
// see if we have a session
if ( isset( $session ) ) {
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
$graphObject = $response->getGraphObject();
$email = $graphObject->getProperty('email');
echo $email;
} else {
$loginUrl = $helper->getLoginUrl();
header("Location: ".$loginUrl);
}
?>

You are not asking for the email permission in your login process:
$loginUrl = $facebook->getLoginUrl(array('scope' => 'email'));
Source: https://developers.facebook.com/docs/reference/php/facebook-getLoginUrl
Side note: Use the autoloader OR countless require statements, not both ;) (Autoloader would be the smart option though).

Related

facebook PHP sdk cannot login

I have been trying to use facebook's PHP sdk to login.
Following is one of my codes.
<?php
session_start();
require_once( 'lib/Facebook/FacebookSession.php' );
require_once( 'lib/Facebook/FacebookRedirectLoginHelper.php' );
require_once( 'lib/Facebook/FacebookRequest.php' );
require_once( 'lib/Facebook/FacebookResponse.php' );
require_once( 'lib/Facebook/FacebookSDKException.php' );
require_once( 'lib/Facebook/FacebookRequestException.php' );
require_once( 'lib/Facebook/FacebookAuthorizationException.php' );
require_once( 'lib/Facebook/GraphObject.php' );
require_once('lib/Facebook/GraphUser.php');
require_once('lib/Facebook/GraphSessionInfo.php');
require_once( 'lib/Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'lib/Facebook/HttpClients/FacebookCurl.php' );
require_once( 'lib/Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'lib/Facebook/Entities/AccessToken.php' );
require_once( 'lib/Facebook/Entities/SignedRequest.php' );
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphUser;
use Facebook\GraphSessionInfo;
use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;
// Initialize application by Application ID and Secret
FacebookSession::setDefaultApplication('app_id','app_secret');
// Login Healper with reditect URI
$helper = new FacebookRedirectLoginHelper( 'http://124.125.244.163/rtCamp/home.php' );
try {
$session = $helper->getSessionFromRedirect();
}
catch( FacebookRequestException $ex ) {
// Exception
}
catch( Exception $ex ) {
// When validation fails or other local issues
}
// Checking Session
if(isset($session))
{
// Request for user data
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
// Responce
$data = $response->getGraphObject();
// Print data
echo print_r( $data, 1 );
}
else
{
// Login URL if session not found
echo 'Login';
}
?>
Now the problem I am facing is that there is some problem with the line where I can get a session.
i.e $session = $helper->getSessionFromRedirect() after the page redirects from facebook.
Now I even implemented this guy's entire github dir with the same login code here
still, my code stops working after that line and there is not a single error displayed. I tried numerous solutions none of them work. I downloaded the stable Facebook PHP SDK 4.0.0 and I am running a home LAMP server with PHP 5.4. I am stuck.
UPDATE: ERROR comes in Apace log
PHP Fatal error: Class
'Facebook\HttpClients\FacebookStreamHttpClient' not found in
/var/www/rtCamp/lib/Facebook/FacebookRequest.php on line 166, referer:
http://124.125.244.163/rtCamp/home.php
<?php
require_once( 'lib/Facebook/FacebookSession.php' );
require_once( 'lib/Facebook/FacebookRedirectLoginHelper.php' );
require_once( 'lib/Facebook/FacebookRequest.php' );
require_once( 'lib/Facebook/FacebookResponse.php' );
require_once( 'lib/Facebook/FacebookSDKException.php' );
require_once( 'lib/Facebook/FacebookRequestException.php' );
require_once( 'lib/Facebook/FacebookAuthorizationException.php' );
require_once( 'lib/Facebook/GraphObject.php' );
require_once('lib/Facebook/GraphUser.php');
require_once('lib/Facebook/GraphSessionInfo.php');
require_once( 'lib/Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'lib/Facebook/HttpClients/FacebookCurl.php' );
require_once( 'lib/Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'lib/Facebook/Entities/AccessToken.php' );
require_once( 'lib/Facebook/Entities/SignedRequest.php' );
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphUser;
use Facebook\GraphSessionInfo;
use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;
session_start();
$app_id='';
$app_secret='';
$redirect_url='http://124.125.244.163/rtCamp/home.php';
// Initialize application by Application ID and Secret
FacebookSession::setDefaultApplication($app_id,$app_secret);
// Login Healper with reditect URI
$helper = new FacebookRedirectLoginHelper($redirect_url);
$session = $helper->getSessionFromRedirect();
// Checking Session
if(isset($session))
{
// Request for user data
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
// Responce
$data = $response->getGraphObject(GraphUser::classname());
$name=$graph->getName();
echo "hi $name";
// Print data
echo print_r( $data, 1 );
}
else
{
// Login URL if session not found
echo 'Login';
}
/*
try {
$session = $helper->getSessionFromRedirect();
}
catch( FacebookRequestException $ex ) {
// Exception
}
catch( Exception $ex ) {
// When validation fails or other local issues
}
// Checking Session
if(isset($session))
{
// Request for user data
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
// Responce
$data = $response->getGraphObject();
// Print data
echo print_r( $data, 1 );
}
else
{
// Login URL if session not found
echo 'Login';
}
*/
?>

PHP Facebook SDK Posting to wall with SDK 4

Before you all tell me there is already alot of tutorials on how to do this but their isn't any tutorials I foud on the brand new sdk so I am looking for some help.
I have just finished coding my facebook login but every time I login it doesn't ask for permission? And I was wondering how you ask for permission to post to their wall because I want to post on their wall saying they logged in every time they do
<?php
// include required files form Facebook SDK
require_once( 'fb/Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'fb/Facebook/HttpClients/FacebookCurl.php' );
require_once( 'fb/Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'fb/Facebook/Entities/AccessToken.php' );
require_once( 'fb/Facebook/Entities/SignedRequest.php' );
require_once( 'fb/Facebook/FacebookSession.php' );
require_once( 'fb/Facebook/FacebookRedirectLoginHelper.php' );
require_once( 'fb/Facebook/FacebookRequest.php' );
require_once( 'fb/Facebook/FacebookResponse.php' );
require_once( 'fb/Facebook/FacebookSDKException.php' );
require_once( 'fb/Facebook/FacebookRequestException.php' );
require_once( 'fb/Facebook/FacebookOtherException.php' );
require_once( 'fb/Facebook/FacebookAuthorizationExcetion.php' );
require_once( 'fb/Facebook/GraphObject.php' );
require_once( 'fb/Facebook/GraphSessionInfo.php' );
use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\Entities\AccessToken;
use Facebook\Entities\SignedRequest;
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookOtherException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphSessionInfo;
// start session
session_start();
// init app with app id and secret
FacebookSession::setDefaultApplication( '798029503541633','e31a63ad8d46d3c5f4c9aea15af4b163' );
// login helper with redirect_uri
$helper = new FacebookRedirectLoginHelper( 'http://mywebsite.com/fblogin.php' );
// see if a existing session exists
if ( isset( $_SESSION ) && isset( $_SESSION['fb_token'] ) ) {
// create new session from saved access_token
$session = new FacebookSession( $_SESSION['fb_token'] );
// validate the access_token to make sure it's still valid
try {
if ( !$session->validate() ) {
$session = null;
}
} catch ( Exception $e ) {
// catch any exceptions
$session = null;
}
}
if ( !isset( $session ) || $session === null ) {
// no session exists
try {
$session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
// When Facebook returns an error
// handle this better in production code
print_r( $ex );
} catch( Exception $ex ) {
// When validation fails or other local issues
// handle this better in production code
print_r( $ex );
}
}
// see if we have a session
if ( isset( $session ) ) {
// save the session
$_SESSION['fb_token'] = $session->getToken();
// create a session using saved token or the new one we generated at login
$session = new FacebookSession( $session->getToken() );
// graph api request for user data
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
// get response
$graphObject = $response->getGraphObject()->asArray();
// print profile data
echo '<pre>' . print_r( $graphObject, 1 ) . '</pre>';
// print logout url using session and redirect_uri (logout.php page should destroy the session)
echo 'Logout';
} else {
// show login url
echo 'Login';
}

Facebook login PHP sdk 4.4

I have been trying to test the Facebook PHP login system but keep getting the error:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /xxxxx/httpd.www/Facebook/FacebookRedirectLoginHelper.php on line 146
I have read through several different examples and tried to implement each after first running into this as well as read through the different questions/answers on here all to no avail.
If anyone has ran into this and found a solution or knows of the solution i would much appreciate the pointer.
Edit current code added.
// init app with app id and secret
FacebookSession::setDefaultApplication( 'xxx','xxx' );
require_once( 'Facebook/FacebookSession.php' );
require_once( 'Facebook/FacebookRedirectLoginHelper.php' );
require_once( 'Facebook/FacebookRequest.php' );
require_once( 'Facebook/FacebookResponse.php' );
require_once( 'Facebook/FacebookSDKException.php' );
require_once( 'Facebook/FacebookRequestException.php' );
require_once( 'Facebook/FacebookAuthorizationException.php' );
require_once( 'Facebook/GraphObject.php' );
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
// login helper with redirect_uri
$helper = new FacebookRedirectLoginHelper( 'http://somesite.com/index.php' );
try {
$session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
// When Facebook returns an error
} catch( Exception $ex ) {
// When validation fails or other local issues
}
// see if we have a session
if ( isset( $session ) ) {
// graph api request for user data
$request = new FacebookRequest( $session, 'GET', '/me' );
$response = $request->execute();
// get response
$graphObject = $response->getGraphObject();
// print data
echo print_r( $graphObject, 1 );
} else {
// show login url
echo 'Login';
}
I got the same question with you.you can not use the "include" like in old version. In v4.4,they use it like this:
define('FACEBOOK_SDK_V4_SRC_DIR', '/path/to/facebook-php-sdk-v4/src/Facebook/');
require __DIR__ . '/path/to/facebook-php-sdk-v4/autoload.php';
and then ,just the same as you
use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
That is all!
reference:Facebook SDK for PHP

I can't get any value from php Facebook graph api

This is my full code.
// include required files form Facebook SDK
require_once( 'Facebook/HttpClients/FacebookHttpable.php' );
require_once( 'Facebook/HttpClients/FacebookCurl.php' );
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'Facebook/Entities/AccessToken.php' );
require_once( 'Facebook/Entities/SignedRequest.php' );
require_once( 'Facebook/FacebookSession.php' );
require_once( 'Facebook/FacebookRedirectLoginHelper.php' );
require_once( 'Facebook/FacebookRequest.php' );
require_once( 'Facebook/FacebookResponse.php' );
require_once( 'Facebook/FacebookSDKException.php' );
require_once( 'Facebook/FacebookRequestException.php' );
require_once( 'Facebook/FacebookOtherException.php' );
require_once( 'Facebook/FacebookAuthorizationException.php' );
require_once( 'Facebook/GraphObject.php' );
require_once( 'Facebook/GraphSessionInfo.php' );
use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\Entities\AccessToken;
use Facebook\Entities\SignedRequest;
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookOtherException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphSessionInfo;
// start session
session_start();
// init app with app id and secret
FacebookSession::setDefaultApplication( 'KEY','SECRET' );
// login helper with redirect_uri
$helper = new FacebookRedirectLoginHelper( 'SITE_NAME.php' );
// see if a existing session exists
if ( isset( $_SESSION ) && isset( $_SESSION['fb_token'] ) ) {
// create new session from saved access_token
$session = new FacebookSession( $_SESSION['fb_token'] );
// validate the access_token to make sure it's still valid
try {
if ( !$session->validate() ) {
$session = null;
}
} catch ( Exception $e ) {
// catch any exceptions
$session = null;
}
}
if ( !isset( $session ) || $session === null ) {
// no session exists
try {
$session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
// When Facebook returns an error
// handle this better in production code
print_r( $ex );
} catch( Exception $ex ) {
// When validation fails or other local issues
// handle this better in production code
print_r( $ex );
}
}
// see if we have a session
if ( isset( $session ) ) {
// save the session
$_SESSION['fb_token'] = $session->getToken();
// create a session using saved token or the new one we generated at login
$session = new FacebookSession( $session->getToken() );
// graph api request for user data
$request = new FacebookRequest( $session, 'GET', '***/1458726944414455/likes***' );
$response = $request->execute();
// get response
$graphObject = $response->getGraphObject()->asArray();
// print profile data
echo '<pre>' . print_r( $graphObject, 1 ) . '</pre>';
// print logout url using session and redirect_uri (logout.php page should destroy the session)
echo 'Logout';
} else {
// show login url
echo 'Login';
}
In * * section above, if I put some Facebook page names or 'me', the code works fine. But when I insert '/1458726944414455/likes' something like this, I can't get any value so the results are always like this
Array ( )
What makes me mad is, /1458726944414455/likes this works fine in https://developers.facebook.com/tools/explorer, which is Graph API explorer. I think token scope is not that different in Graph API explorer and my own website.
What is wrong? I searched every website which wrote about facebook php sdk or graph api, but they are using almost same code with me.
Is this because that I didn't do anything about Review Submission Form? I just using the default App Status & Review. But I thought that it doesn't matter because I don't do login with Facebook something like that. What is wrong? Please help me.
Thank you for reading.

PHP Facebook SDK 4.0 post as a page server to server

I'm trying to post as a page on a Facebook page since 6 days without success, which is really frustrating using new facebook SDK 4.0.4.
I'm under PHP 5.4 (as requested by Facebook 4.0 SDK version).
I already read some times all the facebook documentation (which isn't so clear) https://developers.facebook.com/docs/reference/php/4.0.0.
For logging-in:
<?php
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookSession.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookRedirectLoginHelper.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookRequest.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookResponse.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookSDKException.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookRequestException.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookOtherException.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookAuthorizationException.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/GraphObject.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/GraphSessionInfo.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookServerException.php' );
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookOtherException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphSessionInfo;
use Facebook\FacebookServerException;
session_start();
// init app with app id and secret
FacebookSession::setDefaultApplication($site["facebook_appid"],$site["facebook_appsecret"] );
// login helper with redirect_uri
$helper = new FacebookRedirectLoginHelper($site["url"].$_SERVER['REQUEST_URI']);
// see if a existing session exists
if ( isset( $_SESSION ) && isset( $_SESSION['fb_token'] ) ) {
// create new session from saved access_token
$session = new FacebookSession( $_SESSION['fb_token'] );
// validate the access_token to make sure it's still valid
try {
if ( !$session->validate() ) {
$session = null;
}
} catch ( Exception $e ) {
// catch any exceptions
$session = null;
}
echo 'Logout';
} else {
// no session exists
try {
$session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
// When Facebook returns an error
} catch( Exception $ex ) {
// When validation fails or other local issues
echo $ex->message;
}
echo 'Login';
}
///////////////////////////
// SHORT LIVED TOKEN
$request = new FacebookRequest( $session, "GET", "/".$site["facebook_appid"]."/accounts?access_token=".$site["facebook_appid"]."|".$site["facebook_appsecret"]."&grant_type=client_credentials" );
$response = $request->execute();
// get response
$graphObject = $response->getGraphObject()->asArray();
if (DebugMode) e($graphObject);
$site['facebook_short-lived_access_token'] = $graphObject['data'][0]->access_token;
////////////////////////
///////////////////////////
// LONG LIVED TOKEN
$request = new FacebookRequest( $session, "GET", "/oauth/access_token?grant_type=fb_exchange_token&client_id=".$site["facebook_appid"]."&client_secret=".$site["facebook_appsecret"]."&fb_exchange_token=" .$site['facebook_short-lived_access_token']);
$response = $request->execute();
// get response
$graphObject = $response->getGraphObject()->asArray();
if (DebugMode) e($graphObject);
$site['facebook_long-lived_access_token'] = $graphObject['access_token'];
$_SESSION['fb_token'] = $site['facebook_long-lived_access_token'];
if (DebugMode) e($site['facebook_long-lived_access_token']);
?>
And for publishing:
<?php
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookRequest.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/GraphObject.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookSDKException.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookRequestException.php' );
require_once( BaseRoot. '/include/scripts/facebook_php_sdk/src/Facebook/FacebookPermissionException.php' );
use Facebook\FacebookRequest;
use Facebook\GraphObject;
use Facebook\FacebookRequestException;
use Facebook\FacebookSDKException;
use Facebook\FacebookPermissionException;
if($session) {
try {
$response = (new FacebookRequest(
$session, 'POST', "/".$site["facebook_page_id"]."/feed",
array(
'access_token' => $_SESSION['fb_token'],
'link' => $site["url"].'/url',
'name' => 'link name',
'caption' => 'link caption',
'description' => 'link description',
'picture' => $site["url"].'/alpha.png',
'message' => 'User provided message'
)
))->execute()->getGraphObject();
echo "Posted with id: " . $response->getProperty('id');
} catch(FacebookRequestException $e) {
echo "Exception occured, code: " . $e->getCode();
echo " with message: " . $e->getMessage();
}
}
?>
I first get a session ID, then request and obtain a short-lived token, with which i request and obtain a long-lived token (60 days validity). Then I continue with the publish script using the last obtained token.
I submit a post and it return back a post-id like it works, but nothing on the page, nothing in my personal Facebook history.
My application is in development mode and was not reviewed by Facebook, but it seems to not be necessary anymore: http://www.nextscripts.com/known-issues/facebook-issues/
Any idea where I'm wrong?
I'm not realy into the facebook SDK, but I noticed one line that I suspect to be incorrect:
echo 'Login';
The facebook documentation about this function can be found here.
It states that you schould, to ask for extra permissions, give an array with the index 'scope' and as value in string with a comma between every permission you want to request instead of an array with indexes called to permission but without any data in it. I suspect it should be something like:
$helper->getLoginUrl( array( 'scope' => 'public_profile,email,user_friens,publish_stream,<and so on>'));
I hope this helps you.

Categories