Ionic 2 Facebook Auth with InAppBrowser

Hi everybody,

I am developing mobile application. I should use facebook login in my app and there is facebook auth service in my app. When listened the socket.io, it must close browser. I think session opens InAppBrowser. I want the browser to close and login when the session is opened.

Thanks a lot :slight_smile:

This my code is here:

authFacebook() {
    this.platform.ready().then(() => {
      this.browser = new InAppBrowser(Global.address + "/auth/facebook", "_blank", "location=no");
    });
    Global.socket.on("auth", (res) => {
      console.log("AUTH:", JSON.stringify(res));
      if (res.ok) {
        Global.user = res.data;
        Global.socket.emit("new_user", this.email);
        this.getPages();
      }
      else {
        console.log("ERROR:", res.error);
      }

      this.platform.ready().then(() => {
        this.browser.close();
      });
    });
    this.navCtrl.push(TabsPage);
  }

Have you tried using the Native authentication instead of InAppBrowser?

Facebook Authentication with Ionic 2/Ionic Cloud