title: Phonegap/Cordova facebook login not working when already connected
body: <p>I'm developing and HTML5/CSS/Javascript PhoneGap app that should work as native app for android and iOS and is compiled using the PhoneGap Build service. The app uses Facebook login.</p>
  
  <p>The login is done through the JAVASCRIPT Api. So I have this simple HTML page:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;head&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;meta name="format-detection" content="telephone=no" /&gt;
  &lt;meta name="msapplication-tap-highlight" content="no" /&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /&gt;
  &lt;link href="style.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="cordova.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;div id="fb-root"&gt;&lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
   $(document).on('click', '#login', function(){
     facebookConnectPlugin.login(["email,user_birthday,publish_actions"], function(response) {
        if(response.authResponse) {
           alert(response.authResponse.userID);
        }
     });
   });
  &lt;/script&gt;
  
  &lt;img id="login" src="images/login.png" alt="" /&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>The above code works well when the user hasn't authenticated the app before. So when a user clicks the login button and the user accepts the login, the user id is returned successfully and the session will stick well when the use closes and reopens the app.</p>
  
  <p>The problem lies when the user uninstalls the app and reinstalls again. When they click the login button, the login dialog will open quickly and close again as the user is already authenticated in the app. The user id and access token should return in the response like the regular javascript api of Facebook. Instead the second function which is failure will be returned with the following error:</p>
  
  <pre><code>session was closed and was not closed normally
  </code></pre>
  
  <p>I tried to logout the user but I got the following error:<code>there is no session initiated...</code></p>
  
  <p>I have added the following to the config.xml file:</p>
  
  <pre><code>&lt;gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.9.0"&gt;
     &lt;param name="APP_ID" value="xxxxxx" /&gt;
     &lt;param name="APP_NAME" value="App Name" /&gt;
  &lt;/gap:plugin&gt;
  </code></pre>
  
  <p>Currently the Facebook app has only Website as platform. Do I need to add Android as platform while I'm using the javascript API for authentication?</p>
  
  <p>Is there any solution for this?</p>