I have the following php code that I am trying to test 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"></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>
</> </HTML>
code>
The problem I ran into is working well with IE and Firefox, but when everything is done the same with google chrome, I start an endless loop when I press the Chrome reboot / update button after logging in.
Any hints as to why this happens with chrome? Just like this can be avoided.
Thanks,
Mitesh
source share