Well I've tried to find something on the new Facebook PHP SDK V4 to see if anyone else is having issues and according to some tutorial comments there have been many complaints to Facebook Developers site about the new SDK but will see if anyone here has found a way around it.
So I've set up my new Facebook App the same way I set up any other app in the past. I have my App ID and Secret and have set up my index.php page as follows:-
<?php
session_start();
require_once('Facebook/FacebookSession.php');
require_once('Facebook/FacebookCanvasLoginHelper.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');
use Facebook\FacebookSession;
use Facebook\FacebookCanvasLoginHelper;
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;
$app_id = '..........';
$app_secret = '...........';
FacebookSession::setDefaultApplication($app_id, $app_secret);
$helper = new FacebookCanvasLoginHelper();
try {
$session = $helper->getSession();
} catch (Exception $e) {
echo 'Error: '.$e->getMessage();
}
if ($session) {
//$_SESSION['token'] = $session->getToken();
echo 'Logged In!';
try {
$request = new FacebookRequest($session, 'GET', '/me');
$response = $request->execute();
$graph = $response->getGraphObject();
echo 'Hi '.$graph->getProperty('name');
} catch (FacebookRequestException $e) {
echo $e->getMessage();
}
}
else {
//echo '<a href="'.$helper->getLoginUrl().'">Login</a>';
$helper = new FacebookRedirectLoginHelper('https://apps.facebook.com/event-lister');
$auth_url = $helper->getLoginUrl(array('email', 'user_friends'));
echo '<script>window.top.location.href="'.$auth_url.'"></script>';
}
?>
Apologies for pasting everything in but had to make sure I was thorough in there being everything that was needed in the index.php file.
This produces a blank page and doesn't even offer the opportunity to log in. I've followed two tutorials with no success and the Facebook App has been configured correctly with the correct canvas URL etc... in place
Please can someone let me know if they have had the same issues and if so how did you overcome them or is it an on going thing that Facebook know about and are busy trying to fix? Or have I gone wrong somewhere?