开发者

facebook iframe app problem.... opens on server not in facebook frame

I'm very new to facebook platform.

I developed an iframe app. which after allowing permsiions, opens the application on my server and not in facebook iframe.

I hope i'm clear. I'm using $user = $facebook->require_login().

I read somewhere that adding $facebook->require_frame() would help but it didn't help.

开发者_StackOverflowThe page reloads with new access token on each reload.

Someoe please help me.

Thanks in advance


Can you post some of the code you're using for the redirect?

If you use $facebook->GetLoginUrl to construct the Auth URL, the code should look like this -

 $loginUrl = $facebook->getLoginUrl(array('canvas' => 1,
                                      'fbconnect' => 0,
                                      'req_perms' => 'permissions_here',
                                      'next' => $canvas_base_url . 'index.php',
                                      'cancel_url' => $canvas_base_url
                                     ));

In the Array, define your post authentication URL in 'next'. You should build it using the URL structure of http://apps.facebook.com/CANVASURL/yourpostauthpage.php.

In my snippet, I've created a variable ($canvas_base_url) to store my base URL.


my code is

<?
$api_key = 'xxxxxxxxxxxx';

$secret  = 'xxxxxxxxxxxxx';

$appcallbackurl = 'http://www.phonecurry.com/fbapp/';

include_once 'facebook.php';



$facebook = new Facebook($api_key, $secret);


$user = $facebook->require_login();


try
{
if(!$facebook->api_client->users_isAppUser())
{
?>
<script language="JavaScript">
<!--
window.location = "http://www.facebook.com/login.php?v=1.0&api_key=xxxxxxxxxxxxx&next=http%3A%2F%2Fapps.facebook.com%2Fmycanvasapp%2F&canvas&req_perms=publish_stream";
</script>

<?php
}
}

catch (Exception $ex)
{
$facebook->set_user(null, null);
$facebook->redirect($appcallbackurl);
}

$has_permission = $facebook->api_client->users_hasAppPermission("publish_stream");
if(!$has_permission)
{
?>

<script language="JavaScript">
<!--
window.location = "http://www.facebook.com/login.php?v=1.0&api_key=xxxxxxx&next=http%3A%2F%2Fapps.facebook.com%2Fmycanvasapp%2F&canvas&req_perms=publish_stream";
</script>
<?php
}
?>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜