My app is inside a fan page, when i request permission it will show the dialog. The problem is after user accept, they are redirected to real app page (url here app is hosted)
for understand better i have the url generated with facebook PHP SDK
As we can see will redirect outside of facebook, i want redirect back in that case: https://www.facebook.com/mypage/app_341572315885516
Any way to solve this situation? I have tried a lot of things nothing works...
Wheres my code:
<?php $userid = Yii::app()->facebook->getUser(); ?>
<?php $results = NULL;//$results = Yii::app()->facebook->api('/me'); ?>
<?php
$signed_request = Yii::app()->facebook->getSignedRequest();
if(!isset($signed_request['page']) || !isset($signed_request['page']['liked']))
{
$this->renderPartial('_nofan', array('model'=>$model));
}
else
{
if(!$signed_request['page']['liked'])
{
$this->renderPartial('_nofan', array('model'=>$model));
}
else
{
try
{
$results = Yii::app()->facebook->api('/me');
}
catch (FacebookApiException $e) {
}
if(!$userid || !$results)
{
$loginUrl = Yii::app()->facebook->getLoginUrl(array('scope'=>'user_about_me,user_birthday'));
/*echo "<script type='text/javascript'>top.location.href = '{$loginUrl}';</script>";*/
Yii::app()->clientScript->registerScript('login-perm', 'top.location.href = "'.$loginUrl.'";', CClientScript::POS_HEAD);
//$this->redirect($loginUrl);
/*Yii::app()->facebook->addJsCallback("FB.login(function(response) {
if (response.authResponse) {
// user is logged in and granted some permissions.
} else {
// User cancelled login or did not fully authorize.
}
}, {scope:'user_about_me,user_birthday'});");*/
}
// FAN
//echo 'Olá';
}
}
?>
Thanks