title: Facebook getUser() returns 0
body: <p>I am implementing Facebook login using the PHP SDK with Codeigniter. I get the Facebook login popup, hit login, but I am unable to retrieve the user's id - it always returns 0. </p>
  
  <p>I have put the facebook.php and base_facebook.php files in my libraries file and included it as a library in Codeigniter following a tutorial <a href="http://jondavidjohn.com/blog/2011/07/using-the-facebook-api-with-codeigniter" rel="noreferrer">here</a>.</p>
  
  <p>Can anyone tell me what they think is going on? I am using the following code -</p>
  
  <p><strong>View - Facebook login button</strong></p>
  
  <pre><code>  &lt;div id="fb-root"&gt;&lt;/div&gt;
    &lt;script&gt;
      window.fbAsyncInit = function() {
        FB.init({
          appId      : '&lt;?php echo $this-&gt;config-&gt;item('facebook_app_id'); ?&gt;',
          status     : true, 
          cookie     : true,
          xfbml      : true,
          oauth      : true,
        });
  
            FB.Event.subscribe('auth.login', function() {
              window.location='&lt;?php echo base_url(); ?&gt;auth_other/fb_signin/';
            });
  
      };
      (function(d){
         var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
         js = d.createElement('script'); js.id = id; js.async = true;
         js.src = "//connect.facebook.net/en_US/all.js";
         d.getElementsByTagName('head')[0].appendChild(js);
       }(document));
  
    &lt;/script&gt;
    &lt;div class="fb-login-button"&gt;Login with Facebook&lt;/div&gt;
  </code></pre>
  
  <p><strong>Controller - auth_other/fb_signin</strong></p>
  
  <pre><code>    function fb_signin()
      {           
          $fb_user = null;
  
          $fb_config = array(
          'appId'  =&gt; $this-&gt;config-&gt;item('facebook_app_id'),
          'secret' =&gt; $this-&gt;config-&gt;item('facebook_app_secret')
          );
  
          $this-&gt;load-&gt;library('facebook',$fb_config);
  
          $fb_user = $this-&gt;facebook-&gt;getUser();
  
  
          echo $fb_user;
  </code></pre>