$facebook = new Facebook($configs);
$uid = $facebook->getUser();
if($uid) {
// Do stuffs
} else {
$loginUrl = $facebook->getLoginUrl();
echo('<script> top.location.href = "' . $loginUrl . '";</script>');
}
?>
All work perfectly, but, if user are not logged, the script redirect to Facebook which ask login. When login, the script redirect to my application external url http://mywebsite.com/facebook-app and not my apps.facebook.com/myappid.
Check that the URLs on the apps settings page on Facebook Developer are correct. If your app is of the ‘App on Facebook’ type, check that
are correct.
If it’s a ‘Mobile Web’ app, check
and so on depending on the type of app.