FB Connect going in an infinite loop with google chrome

Posted by Mitesh on Stack Overflow See other posts from Stack Overflow or by Mitesh
Published on 2010-12-22T09:49:37Z Indexed on 2010/12/22 9:54 UTC
Read the original article Hit count: 219

Hi,
I am having the following php code which i am trying for testing FB Connect


<?php 
define('FACEBOOK_APP_ID', 'YOUR_APP_ID');
define('FACEBOOK_SECRET', 'YOUR_APP_SECRET');

function get_facebook_cookie($app_id, $application_secret) { enter code here $args = array(); parse_str(trim($COOKIE['fbs' . $app_id], '\"'), $args); ksort($args); $payload = ''; foreach ($args as $key => $value) { if ($key != 'sig') { $payload .= $key . '=' . $value; } } if (md5($payload . $application_secret) != $args['sig']) { return null; } return $args; } $cookie = get_facebook_cookie(FACEBOOK_APP_ID, FACEBOOK_SECRET); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <body>
<?php if ($cookie) { ?> Your user ID is <?= $cookie['uid'] ?> <br /> Your Acess Token is <br /> <?php
$user = json_decode(file_get_contents( 'https://graph.facebook.com/me?access_token=' . $cookie['access_token'])); if($user) { echo "<br />Display Name = " . $user->name; echo "<br />First Name = " . $user->first_name; echo "<br />Last Name = " . $user->last_name; echo "<br />Birthday = " . $user->birthday; echo "<br />Home Town = " . $user->hometown->name; echo "<br />Location = " . $user->location->name; echo "<br />Email = " . $user->email . "<br />"; } ?> <?php } else { ?> <fb:login-button perms="email,user_birthday,publish_stream"></fb:login-button> <?php } ?>

<div id="fb-root">&lt;/div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({appId: '<?= FACEBOOK_APP_ID ?>', status: true,
           cookie: true, xfbml: true});
  FB.Event.subscribe('auth.login', function(response) {
    window.location.reload();
  });
</script>

</body> </html>


The problem faced by me is it works fine with IE and Firefox, however when done the same with google chrome I am running into an infinite loop when I click on reload/refresh button of chrome after logging in.

Any hints as to why is it happening with chrome? Also how can it be avoided.

Thanks,
Mitesh

© Stack Overflow or respective owner

Related posts about google-chrome

Related posts about facebook-connect