title: Facebook PHP SDK getUser works with canvas app on Facebook but in mobile site it doesn't work
body: <p>I've made a Facebook app which works perfectly, so now I'm trying to setup a mobile app. I use this code with is described in the docs to check if the user is logged in or not, and if the user is logged in pass the information forward.</p>
  <p>Here is the code I'm using:</p>
  <pre><code>&lt;?php 
  session_start();
  
  // Include facebook PHP SDK
   require_once(&quot;lib/facebook.php&quot;);
   
  
  // Configure the facebook object
  $config = array();
  $config['appId'] = 'APP_ID';
  $config['secret'] = 'APP_SECRET';
  $config['cookie'] = true;
  $config['fileUpload'] = true;
  
  $app_id = 'APP_ID';
  $canvas_page = &quot;https://hadadmin.yourwebhosting.com/mixit/mobile/&quot;;
  
       $location = &quot;https://www.facebook.com/dialog/oauth?client_id=&quot; 
          . $app_id . &quot;&amp;redirect_uri=&quot; . urlencode($canvas_page) . &quot;&amp;scope=publish_stream,email,create_event,rsvp_event,user_events,friends_events&quot;;
  
      // initialize the facebook oject
    $facebook = new Facebook($config);
  
      // Get Facebook User
      $fbID = $facebook-&gt;getUser();
   
      // Get the current access token
      $access_token = $facebook-&gt;getAccessToken();
      
      // check if we have valid user
  if ($fbID) {
      try {
          // Proceed knowing you have a logged in user who's authenticated.
          $fb_user_profile = $facebook-&gt;api('/me');   
  
      } catch (FacebookApiException $e) {
          $fbID = NULL;
          // seems we don't have enough permissions
          // we use javascript to redirect user instead of header() due to Facebook bug
          print '&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt; top.location.href=&quot;'. $location .'&quot;; &lt;/script&gt;';
  
          // kill the code so nothing else will happen before user gives us permissions
          die();
      } 
  
  } else {
      // seems our user hasn't logged in, redirect him to a FB login page
  
  print '&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt; top.location.href=&quot;'. $location .'&quot;; &lt;/script&gt;';
  
    // kill the code so nothing else will happen before user gives us permissions
     die();
  }
  </code></pre>
  <p>I've searched all over but none of the solutions to similar problems are working (i.e. getUser returns 0) getUser is returning 0 like in the other posts, but like I said it works fine when I don't use the mobile site, apps.facebook.com/MYAPP and <a href="https://hadadmin.yourwebhosting.com/mixit/" rel="nofollow noreferrer">https://hadadmin.yourwebhosting.com/mixit/</a> is also working.</p>