title: Connect with facebook using PHP SDK in codeigniter
body: <p>Im implementing facebook's PHP SDK for authentication <a href="http://skillpaper.com/exams" rel="nofollow">here</a>. I've searched over net and found lots of tutorial on that. like <a href="http://www.galalaly.me/index.php/2012/04/using-facebook-php-sdk-3-with-codeigniter-2-1/" rel="nofollow">Using Facebook PHP SDK 3 with CodeIgniter</a></p>
  
  <p>i've modified base_facebook.php to return <strong>www.skillpaper.com/auth/fb_register</strong> in  </p>
  
  <pre><code>$this-&gt;facebook-&gt;getLoginUrl()
  </code></pre>
  
  <p>when i click "Connect with Facebook" in login modal  and facebook auth popup appears its successfully redirect to my given url. i.e <strong>www.skillpaper.com/auth/fb_register</strong></p>
  
  <p>and my code is like in auth controller:</p>
  
  <pre><code>public function fb_register(){
  
          $userId = $this-&gt;facebook-&gt;getUser();
          if($userId != 0){
              // Get user's data and print it
              $user = $this-&gt;facebook-&gt;api('/me');
              var_dump($user);
          }else{ echo "No user";}
  }
  </code></pre>
  
  <p>i'm getting "No user" every time!
  What am i missing? I don't want to use any JS API for this. any suggestion?</p>
  
  <p>Thanks in advance.</p>