Ionic 4: failed facebook login with android when the native facebook app is installed


I am working in an app using Ionic 4. One of the requeriments is the user can log in using facebook. I follow this tutorial:, facebook and works almost perfectly the functionality.

I am using this app:

Testing the app I found out the login fails when the native android facebook app is installed in the device.

I have replicated, the experiment in three diferents devices.

Here is the process when facebook app is not installed in the device:

enter image description here

The when I do click in the facebook login button, the facebook login box appears perfectly:

enter image description here

Now, when I tried to do the same when the facebook app is installed in the device happen the following:

enter image description here

I do click in the facebook login button

enter image description here

The login box of the facebook app appears, and I logged in the the facebook app.

enter image description here

But this error is show: “There is an error in logging you into this application. Please try again later”

I uninstalled the facebook app, and the login works again.

This is my login facebook function code:

    fbLogin() {
this.platform.ready().then(() => {

      if ('android')) {

  this.fb.login(['public_profile', 'user_friends', 'email'])
    .then(res => {
      if (res.status === 'connected') {
        this.isLoggedIn = true;
      } else {
        this.isLoggedIn = false;
    .catch(e => console.log('Error logging into Facebook', e));




I found this a similar app with another facebook login plugin for react:

Their “workaround” was to force the app to call regular facebook login box like this:

if (Platform.OS === "android") {

Is any similar “workaround” or way to force to use the web facebook login box without call the facebook app?

Thank you.

I don’t know if what I did was correct, I don’t know if what I did was correct, but I wanted to put on record.

I check the plugin files. I studied one file in particular:

From what I see in others forums, I did the following

I added this library

import com.facebook.login.LoginBehavior;

And any line where the following command was:

LoginManager.getInstance().logInWithReadPermissions(cordova.getActivity(), permissions);

In the line before I added this:

  // Create the request
            LoginManager.getInstance().logInWithReadPermissions(cordova.getActivity(), permissions);

And worked perfectly. Now I can login in when the facebook added is installed.

I know this is a workaround.


In which file are these changes to be made? Do you get the exact solution for this?

In this file:

Look for this line (appears like three times)
LoginManager.getInstance().logInWithReadPermissions(cordova.getActivity(), permissions);

before this lines I added (in all)

This is the file path: plugins\cordova-plugin-facebook4\src\android

thanks for reply…but it’s not working for me…

Facebook login via browser works perfectly but not working when native has Facebook app installed.

is there any other solution for this?

Hello Everybody:

I can confirm is the same behavior in IOS with native Facebook App Installed, in Android works well.

This my snippet:

  facebookLogin(): Promise<any> { 
    return this.facebook.login(['email']).then(
      response => {
        const facebookCredential = firebase.auth.FacebookAuthProvider.credential(response.authResponse.accessToken);
          .then(success => {
//Expecting data here when the popup get closed, but nothing happens, instead in the app the process  starts again and again, 
            console.log("Firebase Success: " + JSON.stringify(success));
    ).catch((error) => {