Reputation: 11782
I am trying to integrate facebook php sdk
Following is the code i have tried by reading The facebook tutorial
// init app with app id (APPID) and secret (SECRET)
FacebookSession::setDefaultApplication('APP ID','APP SECRET');
$helper = new FacebookCanvasLoginHelper();
try {
$session = $helper->getSession();
} catch(FacebookRequestException $ex) {
echo $ex;
} catch(\Exception $ex) {
echo $ex;
}
However what i get when i open the app on my canvas page as
exception 'Facebook\FacebookSDKException' with message 'Invalid signed request, missing OAuth data.' in /home/thevowaa/public_html/v1/Facebook/FacebookSession.php:267 Stack trace: #0 /home/thevowaa/public_html/v1/Facebook/FacebookSession.php(209): Facebook\FacebookSession::parseSignedRequest('ZM_-jIn_Cm4WHMZ...', NULL) #1 /home/thevowaa/public_html/v1/Facebook/FacebookCanvasLoginHelper.php(60): Facebook\FacebookSession::newSessionFromSignedRequest('ZM_-jIn_Cm4WHMZ...') #2 /home/thevowaa/public_html/v1/index.php(35): Facebook\FacebookCanvasLoginHelper->getSession() #3 {main}
What kind of data am i missing because there is nothing else explained in documentation.
Upvotes: 3
Views: 1897
Reputation: 11782
Facebook doc been extremely stupid. They made it hard for devs to test.
You have to Go to developers.facebook.com > Tools > Access Tokens > Grant permission to yourself.
That solved the problem
Upvotes: 1
Reputation: 59
I was working with the new facebook sdk and i stumbled upon this website that explains to you how to use the login feature for the SDK. the examples use namespaces so you need at least php 5.4 link to new Facebook SDK tutorial
Upvotes: 1