Facebook require_login() in iFrame App

Posted by LapKom on Stack Overflow See other posts from Stack Overflow or by LapKom
Published on 2010-03-29T13:10:49Z Indexed on 2010/03/29 13:13 UTC
Read the original article Hit count: 706

Filed under:
|
|
|
|

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">
<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">
<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.

© Stack Overflow or respective owner

Related posts about facebook

Related posts about kohana