title: Codeigniter getuser() returns 0 after facebook dialog
body: <p>You could say that this post is dublicate but I'm searching for nearly 2 days , couldn't figured out.</p>
  
  <p>After moved to new server and installed new ssl, I'm having difficulties for facebook login in two different scenarios.</p>
  
  <p><strong>First Scenario:</strong></p>
  
  <p>User haven't logged in to facebook and facebook login redirects user to , facebook login. After user login, facebook redirects to redirect_url and getuser returns 0.</p>
  
  <p>(User could login if return back to facebook login page on my website so getuser works when user already logged in to facebook).</p>
  
  <p><strong>Second Scenario:</strong></p>
  
  <p>User signs up, goes to permissions dialogue and when user gives permissions, again getuser returns 0 , so I was thinking to skip first scenario but this scenario is viral.</p>
  
  <p><strong>I have tried this solutions :</strong></p>
  
  <p>We are using nginx now, in previous server I did this updates and today I will tell you which conf we already added.</p>
  
  <p>1- Base_facebook.php code needs to be updated for codeigniter and new php versions.</p>
  
  <p><a href="https://www.webniraj.com/2012/12/19/facebook-php-sdk-fixing-getuser-on-php-5-4-x" rel="nofollow noreferrer">Facebook PHP SDK: Fixing getUser() on PHP 5.4.x</a></p>
  
  <p>2- Nginx cookie sized changed, at the beginning even normal facebook login doesn't work.</p>
  
  <p>3- I read something about nginx custom headers , we did these updates <a href="https://serverfault.com/questions/403728/nginx-php-fpm-and-custom-header">nginx-php-fpm-and-custom-header</a></p>
  
  <p><a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers" rel="nofollow noreferrer">Nginx underscore headers</a></p>
  
  <p>4- CURLOPT_SSL_VERIFYPEER => false added to base_facebook, again another solution for other users.</p>
  
  <p>I think after all these updates we missed a little something but I really can't see what is wrong? So I will be really happy if you could share your experience with me we could figure out what is wrong.</p>
  
  <p>5-  parse_str($_SERVER['QUERY_STRING'],$_REQUEST); added before libraries included.</p>
  
  <p>My example fb_login controller. I'm tank_auth_social with tank_auth</p>
  
  <pre><code> function fblogin()
  {
  
      parse_str($_SERVER['QUERY_STRING'],$_REQUEST);
      $this-&gt;load-&gt;helper(array('form', 'url'));
      $this-&gt;load-&gt;library('form_validation');
      $this-&gt;load-&gt;library('security');
      $this-&gt;load-&gt;library('tank_auth');
      $this-&gt;load-&gt;library('tank_auth_social');
      $this-&gt;lang-&gt;load('tank_auth');
      $fb_id = $this-&gt;facebook-&gt;getUser();
  
      //inline_debug($fb_id);
      // To see if we have facebook id
  
  
  
  
      // User is found
      if( isset($fb_id) )
      {
          $user_profile = $this-&gt;facebook-&gt;api('/'.$fb_id);
  
      }
  </code></pre>
  
  <p>My Conf:</p>
  
  <p>PHP Version 5.5.9-1ubuntu4
  Nginx, FPM PHP
  My server is on digitalocean.</p>
  
  <p>Thanks alot.</p>