title: Using Facebook PHP SDK 4 but there's no session being stored
body: <p>I've never used the Facebook SDK 4, and I'm had a look at a lot of answers on here to no success.</p>
  
  <p>I'm trying to use the facebook login part of the api, but everytime i re-direct back from facebook there are's no session stored.. here's the code:</p>
  
  <pre><code>&lt;?php
  // I am using autoload just to make sure it was including the requested classes, it makes no difference if i include them separately the outcome is the same.
  
  function __autoload($classname) {
      $filename = "../Facebook/". end(explode("\\",$classname)) .".php";
      include_once($filename);
  }
  
  use Facebook\FacebookSession;
  use Facebook\FacebookRedirectLoginHelper;
  use Facebook\FacebookRequest;
  use Facebook\FacebookResponse;
  use Facebook\FacebookSDKException;
  use Facebook\FacebookRequestException;
  use Facebook\FacebookOtherException;
  use Facebook\FacebookAuthorizationException;
  use Facebook\GraphObject;
  use Facebook\GraphSessionInfo;
  
  // start session
  session_start();
  
  // init app with app id and secret - 
  FacebookSession::setDefaultApplication( '****','****' );
  
  // login helper with redirect_uri
  $helper = new FacebookRedirectLoginHelper( 'http://dev.mydomain.co.uk/fb/index.php' );
  
  
  try {
    $session = $helper-&gt;getSessionFromRedirect();
  } catch(FacebookRequestException $ex) {
    // When Facebook returns an error
  } catch(\Exception $ex) {
    // When validation fails or other local issues
  }
  if ($session) {
    // Logged in
      print('loggedin');
  } else {
      print('no session');
      $loginUrl = $helper-&gt;getLoginUrl();
      ?&gt;
      &lt;a href="&lt;?=$loginUrl?&gt;"&gt;login&lt;/a&gt;
      &lt;?php
  }
  </code></pre>
  
  <p>I've replaced the app id and secret, and the redirect uri is correct but ive just replaced the domain here.</p>
  
  <p>It returns back to my login page, just always prints "no session". So it looks like <code>$session = $helper-&gt;getSessionFromRedirect();</code> is not doing what i need it to.</p>
  
  <p>I got this code from the facebook developers site. </p>
  
  <p><strong>Things I've tried:</strong></p>
  
  <ul>
  <li>Including the class files separately instead of autoload</li>
  <li>Moved the whole thing into a seperate directory with out anything else in the index.php file</li>
  <li>Removed my .htaccess file to make sure it's not something interfering with the GET requests.</li>
  <li>I've also tried a few different tutorials i.e <a href="http://metah.ch/blog/2014/05/facebook-sdk-4-0-0-for-php-a-working-sample-to-get-started/" rel="nofollow">http://metah.ch/blog/2014/05/facebook-sdk-4-0-0-for-php-a-working-sample-to-get-started/</a> using their code exactly (but replacing app_id, app_sec, and the url bits) - but i still return no session</li>
  </ul>
  
  <p>I'm at a bit of a loss, so if someone has experience with this it would be helpful</p>