cordova-plugin-facebook4 - Blank Dialog with "Not Logged In: You are not logged in. Please login and try again"

1k Views Asked by At

Screenshot

Image of Error

Issue

facebookConnectPlugin.login dialog shows error in screenshot. The only thing that can be done is selection of the X close-out button which results in the following error:

errorCode: "4201"
errorMessage: "User cancelled dialog"
loginError @ facebook.js:13

What are we doing wrong?

Plugin version, OS, devices, etc

8.1.1 ([email protected])
cordova-plugin-facebook4 3.0.0
Android 7.1.1
OSX 10.13.6

code

https://github.com/lightbeard/reproduce-fb-login

document.addEventListener('deviceready', deviceReady, false);

function deviceReady() {

  var fbLoginSuccess = function (userData) {
    console.log("UserInfo: ", userData);
  }

  facebookConnectPlugin.login(["public_profile"], fbLoginSuccess,
    function loginError (error) {
      console.error(error)
    }
  );
}
1

There are 1 best solutions below

0
On BEST ANSWER

Awesome, nice to hear it worked out :)

To solves the error OP had to do the two following things:

  1. Adding the missing configuration for cordova-android >= 7 in config.xml Like described in the documentation https://github.com/jeduan/cordova-plugin-facebook4/blob/master/docs/android/README.md

    <config-file parent="/resources" target="./res/values/strings.xml">
        <string name="fb_app_id">123456789</string>
        <string name="fb_app_name">myApplication</string>
    </config-file>
    
  2. Adding an Android platform to the corresponding Facebook App in his/her Facebook developper console https://developers.facebook.com/apps