I am developing a facebook canvas app with the latest php sdk (v4 at time of writing). Previously I used the JS SDK with login callbacks to authenticate, but I'm now using the PHP SDK (don't want to use JS) and have removed the app from my test account. I want to add it again, but this time using only the PHP SDK. I have the following code in my index.php
require '../vendor/autoload.php';
use Facebook\FacebookSession;
use Facebook\FacebookJavaScriptLoginHelper;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
use Facebook\FacebookCanvasLoginHelper;
FacebookSession::setDefaultApplication('123123132', 'cafebabe');
// Add `use Facebook\FacebookCanvasLoginHelper;` to top of file
$helper = new FacebookCanvasLoginHelper();
try {
$session = $helper->getSession();
if ($session) {
echo 'Login';
} else {
echo 'Not logged in';
}
} catch(FacebookRequestException $ex) {
// When Facebook returns an error
} catch(\Exception $ex) {
// When validation fails or other local issues
}
When I access my app's page I just get "Not logged in", meaning session . Am I meant to do something else? I believe I need to approve the App's use (like what permission I wish to give the app, like I did with JS, at some point in time?). I've been using the official facebook documentation along with searching for other tutorials, and haven't found a way to do it outside of using JavaScript.
Thanks