Facebook Connect from Localhost, doing some weird stuff

Posted by Brett on Stack Overflow See other posts from Stack Overflow or by Brett
Published on 2010-01-06T16:38:09Z Indexed on 2012/06/10 4:40 UTC
Read the original article Hit count: 184

Filed under:
|
|

So maybe the documentation is out of date, or I am just off here. But I have done a slew of FB iframe apps (connect), but I am starting my first FB Connect site. Running it from localhost, and the Connect URL is http:// my_external_IP_address. When I click on the FB login button on my site, it pops up, says waiting for facebook, and it returns my site in that box, with the URL up top with the http:// mysite/?session={session key, user_id, etc.} The user_id is infact my FB id. And so it thinks I am logged in. If I close the popup, I'm not logged in. I'm not sure why the pop up isn't doing the normal fb connect dialog. I'm following these steps.

(I added spaces to the http:// as to not be detected as 'spam')

  1. html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"
  2. right after <body> <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript">
  3. At the end, before the body close tag: script type="text/javascript"> FB.init("fbkey", "http://127.0.0.1/xd_receiver.htm"); I have tried using xd_receiver.htm, /xd_receiver.htm (and other combos), and that brings up a blank page. using the http://127.0.0.1 at least does something.

In my config file, which is called before all of those, it checks for a PHP session key to see if they are logged in, if that doesn't exist it looks for a cookie, and if that doesn't exist it does this:

 require_once('includes/facebook.php');
  $facebook = new Facebook($fbkey, $fbsec); 
  $user_id = $facebook->get_loggedin_user();

  if($user_id > 0){
    $user = $ac->getUserFromFB($user_id);
    $_SESSION['user_id'] = $user['user_id'];
  }

The user_id is always empty when I echo it out to the screen to test. The session event never occurs as well. So I don't know what it is doing in the popup, but I think Facebook thinks it is logging me in. Not sure. Pretty stumped on this one. Any help would be appreciated. Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about facebook-connect