title: Can't getUser after using Facebook registration plugin
body: <p>So I'm using the Facebook registration plugin along with the Javascript SDK (to display it using xfbml). The registration works fine and my code to process it looks like this:</p>
  
  <pre><code># Check if the form has been submitted.
  if(array_key_exists('signed_request', $_REQUEST))
  {
      define('FACEBOOK_APP_ID', 'REMOVED');
      define('FACEBOOK_SECRET', 'REMOVED');
  
      function parse_signed_request($signed_request, $secret) {
          list($encoded_sig, $payload) = explode('.', $signed_request, 2); 
  
          // decode the data
          $sig = base64_url_decode($encoded_sig);
          $data = json_decode(base64_url_decode($payload), true);
  
          if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
              error_log('Unknown algorithm. Expected HMAC-SHA256');
              return null;
          }
  
          $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
          if ($sig !== $expected_sig) {
              error_log('Bad Signed JSON signature!');
              return null;
          }
  
          return $data;
      }
  
      function base64_url_decode($input) {
          return base64_decode(strtr($input, '-_', '+/'));
      }
  
      if ($_REQUEST) {
          # Load the Users model.
          $this-&gt;load-&gt;model('Users');
  
          # Save the data from the form.
          $response = parse_signed_request($_REQUEST['signed_request'], FACEBOOK_SECRET);
  
          # Save the user's email.
          $user['email'] = $response['registration']['email'];
  
          # Boolean that stores if the user registered through FB.
          $facebook;
  
  // the rest is irrelevant
  </code></pre>
  
  <p>So once the user is registered I redirect them back to the home page. When I log into my Facebook account, my website shows up under the apps I've used (in the privacy settings).</p>
  
  <p>Despite that, the user doesn't appear authenticated when I try to use the PHP SDK on the home page. The following code prints out "0" as the $user_id and "not valid" as $isvalid. The following code is for the home page:</p>
  
  <pre><code>require 'application/sdk/facebook.php';
  
  $facebook = new Facebook(array(
    'appId'  =&gt; 'REMOVED',
    'secret' =&gt; 'REMOVED',
  ));
  
  // Get User ID
  $user = $facebook-&gt;getUser();
  
  echo $user;
  $isvalid;
  
  try { 
      $facebook-&gt;api('/me');
      $isvalid = true;
  } catch (FacebookApiException $e) {
      $isvalid = false;
      echo "not valid";
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Thanks!</p>