开发者

facebook permission not working in iframe app

开发者 https://www.devze.com 2023-02-20 18:37 出处:网络
i want to go to next page in an iframe based application in facebook and i want to get permission in that page but permission code didnt work in next page. although working in default index page

i want to go to next page in an iframe based application in facebook and i want to get permission in that page but permission code didnt work in next page. although working in default index page here is my code this work fine in index.php but not working redirect page

$app_id = '107919565956374';

$canvas_page = 'http://www.roohware.net/products/mytestapp/';

$auth_url = "http://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($pay开发者_如何学Pythonload, '-_', '+/')), true);

if (empty($data["user_id"])) {
echo("<script> top.location.href='" . $auth_url . "'</script>");
} else {
echo ("Welcome User: " . $data["user_id"]);
}


Rather than

echo("<script> top.location.href='" . $auth_url . "'</script>");

Try with,

echo "<a target='_parent' href='" . $auth_url . "'>Allow application</a>";


replace

echo("<script> top.location.href='" . $auth_url . "'</script>");

with

echo '<fb:redirect url="'.$auth_url.'" />


Use this one:

        echo "<fb:redirect url={{$auth_url}} />";
0

精彩评论

暂无评论...
验证码 换一张
取 消