I have a facebook page where I have added a tab of my application. I use to check that the user is authenticated or not using the following code:-
<?php
$app_id = "MY APP ID";
$canvas_page = "MY CANVAS PAGE";
$auth_url = "https://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page);
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["user_id"])) {
echo("<script> top.location.href='" . $auth_url . "'</script>");
} else {
echo("<script> location.href='index.php'</script>");
}
?>
Now as CANVAS PAGE
has to be the same CANVAS PAGE
I have changed in the application, after logging in page redirects to https://apps.facebook.com/myappname/
, but I want it to redirect to my Facebook page tab; To this one - https://www.facebook.com/myfbpage/app_82136128736123.