title: Ionic 2 Facebook login
body: <p>I found this code:</p>
  
  <pre><code>login() {
      this.platform.ready().then(() =&gt; {
          this.facebookLogin().then((success) =&gt; {
              alert(success.access_token);
          }, (error) =&gt; {
              alert(error);
          });
      });
  }
  
  
  facebookLogin() {
      return new Promise(function(resolve, reject) {
          var browserRef = window.cordova.InAppBrowser.open("https://www.facebook.com/v2.0/dialog/oauth?client_id=" + "CLIENT_ID_HERE" + "&amp;redirect_uri=http://localhost/callback&amp;response_type=token&amp;scope=email", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");
          browserRef.addEventListener("loadstart", (event) =&gt; {
              if ((event.url).indexOf("http://localhost/callback") === 0) {
                  browserRef.removeEventListener("exit", (event) =&gt; {});
                  browserRef.close();
                  var responseParameters = ((event.url).split("#")[1]).split("&amp;");
                  var parsedResponse = {};
                  for (var i = 0; i &lt; responseParameters.length; i++) {
                      parsedResponse[responseParameters[i].split("=")[0]] = responseParameters[i].split("=")[1];
                  }
                  if (parsedResponse["access_token"] !== undefined &amp;&amp; parsedResponse["access_token"] !== null) {
                      resolve(parsedResponse);
                  } else {
                      reject("Problem authenticating with Facebook");
                  }
              }
          });
          browserRef.addEventListener("exit", function(event) {
              reject("The Facebook sign in flow was canceled");
          });
      });
  }
  </code></pre>
  
  <p>I am a bit confused, how does Ionic 2 app recognizes when user is signed in with some social apps like facebook/google?
  For example, I want to make a landing page, which prompts for facebook login, and as soon as user is logged-in, dont show the page.
  I am familiar with nodejs+passportjs which stores session/cookies, but how Ionic 2 it does?</p>