I'm a PHP developer and I have nice experience with Facebook PHP SDK, but this time I'm lost :(
My problem is the following: I'm developing a facebook page tab application with Laravel, a PHP framework. This is my code:
//getting the Facebook class instance
$facebook = IoC::resolve('facebook-sdk');
if(!$facebook->getUser()){
$pagetab_url = 'https://www.facebook.com/PAGEUSERNAME?sk=app_APPID';
$loginUrlParams = array(
'scope' => 'publish_stream',
'redirect_uri' => $pagetab_url
);
$loginUrl = $facebook->getLoginUrl($loginUrlParams);
echo("<script> top.location.href='" . $loginUrl . "'</script>");
}
else{
echo $facebook->getUser();
}
This code generates an infinite loop, because $facebook->getUser() always returns zero. AppId and AppSecret are correct, infact, if I change 'redirect_uri' to any page of my app domain, it works (for example: 'redirect_uri' => 'https://www.mysite.com/fb_callback').
Additional details: the signed request is always null. Do you have any idea?
Many thanks!
EDIT This solved my problem Facebook iframe tab signed request always empty