views:

817

answers:

1

Hi,

I have serious problem with iframe application. I need to use many external JS libraries and other dynamic stuuf so FMBL application can't be done. When I call require_login() I get applicaition installing dialog when app is not already installed, which is ok. But then after authorization application enters an endless redirect loop with parameters like auth_token, installed and so. Yesterday I managed to fix this, but today it's broken again... What the heck is happening with FB? It's driving me crazy to find a sollution, none of ones found on net doesn't seem to be working.

So far I tried:

http://abhirama.wordpress.com/2010/03/07/facebook-iframe-xfbml-app/ (7th march 2010!) http://forum.developers.facebook.com/viewtopic.php?pid=156092 http://www.keywordintellect.com/facebook-development/how-to-set-up-a-facebook-iframe-application-in-php-in-5-minutes/

http://www.markdeepwell.com/2010/02/validating-a-facebook-session-within-an-iframe/ http://forum.developers.facebook.com/viewtopic.php?pid=210449 http://www.ajaxlines.com/ajax/stuff/article/facebook_fbml_rendering_in_iframe_application.php http://www.aratide.com/php/solving-the-break-out-issue-in-iframe-facebook-applications/

None of the above worked... According to those and some FB docs: http://wiki.developers.facebook.com/index.php/FB_RequireFeatures http://wiki.developers.facebook.com/index.php/Cross_Domain_Communication_Channel

My example test files look as follow:

<?php
//Link in library.
require_once '../application/vendor/Facebook/facebook.php';

//Authentication Keys
$appapikey = 'XXXX';
$appsecret = 'XXXX';

//Construct the class
$facebook = new Facebook($appapikey, $appsecret);

//Require login
$user_id = $facebook->require_login();

?>

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"&gt;
<head>
  <title></title>
</head>
<body>
  <script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
  This is you: <fb:name uid="<?php echo  $user_id?>"></fb:name>
  <?php var_dump($facebook->$this->facebook->api_client->friends_get())?>
  <script type="text/javascript">
 FB_RequireFeatures(["XFBML"], function(){
  FB.Facebook.init("<?=$appapikey?>", "xd_receiver.html");
 });
  </script>
</body>
</html>

And cross-domain file xd_receiver.html is:

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head>
    <title>cross-domain receiver page</title>
  </head>
  <body>
    <script src="http://static.ak.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script>
  </body>
</html>

How do I get it working?

I'm using Kohana framework to do this and already replaced header('Location') with url::redirect() in facebook php library.

+1  A: 

Facebook restricts the usage of many HTML tags. It seems that you are using some of the restricted tags in your code. Have you tried removing those?

In case you want to use those tags (<body> for e.g.) make it an iframe application instead of fbml...

Yash
It is an iframe application. I try to call require_login inside iframe and I get redirected outside Facebook to my application on my server ending with endless loop with auth_token variable in URI. I tried to meake FBML app as well and put iframe in canvas using <fb:iframe> but the flow is just the same.
Karol Janyst