title: Facebook app does not redirect mobile site url
body: <p>On my app settings I have as mobile URL this one:</p>
  
  <pre><code>https://example.herokuapp.com/mobile.php#&amp;ui-state=dialog
  </code></pre>
  
  <p>However, when I try to access the app from Facebook using a smartphone, Facebook redirects to an OAuth URL for a few milliseconds, and then it redirects to:</p>
  
  <pre><code>https://example.herokuapp.com/?state=63903485c518f2ae5deca667b9a............#_=_
  </code></pre>
  
  <p>As the /mobile.php is lost, the desktop version is loaded instead. </p>
  
  <p>How can I fix this? Any advice is very much appreciated.</p>
  
  <p>Thank you very much</p>
  
  <p><strong>Edit: piece of security code</strong></p>
  
  <pre><code>try {
      $facebook = new Facebook(array(
              'appId'  =&gt; AppInfo::appID(),
              'secret' =&gt; AppInfo::appSecret(),
      ));
      $access_token=$_GET['access_token'];
      Log::debug("BaseControl:access token: ". $access_token);
      if(isset($access_token)){
          $facebook-&gt;setAccessToken($access_token);
      }
      $user_id = $facebook-&gt;getUser();
  } catch (Exception $e) {
      exit("Error getting facebook data");
  }
  
  if ($user_id) {
      try {
          $basic = $facebook-&gt;api('/me');//se necesita access token, si no se tiene falla
      } catch (FacebookApiException $e) {
          if (!$facebook-&gt;getUser()) {
              exit("Invalid access token");
          }
      }
      if($basic==null){
          exit("Application not installed");
      }
      $user=UsersLogic::getUser($user_id);
      if($user==null){
          exit("User not registered in database");
      }
  
  }
  else{
      exit("No user logged");
  }
  </code></pre>