Cordova facebook4 plugin unable to login

I’m trying to make login

var c = new Array(“photo”,“friends”,“email”);
facebookConnectPlugin.login(c, function fb_succ(data) {
alert(“LOGIN SUC”);
alert(data);
},
function fb_fail(data) {
alert(“LOGIN FAILED”);
alert(data);});

alert(“FB TRY DONE”);
}

But nohing happens. It’s just rolling.

I tought my situation was like in Troubleshooting descriped and tryied the code from there to get hash

try {
PackageInfo info =
cordova.getActivity().getPackageManager().getPackageInfo(“com.goapes.golearn”, PackageManager.GET_SIGNATURES);

for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance(“SHA”);
md.update(signature.toByteArray());
Log.e(“MY KEY HASH:”, Base64.encodeToString(md.digest(), Base64.DEFAULT));
}

} catch (NameNotFoundException e) {

} catch (NoSuchAlgorithmException e) {

}

But it does not work at all with no error

I would suggest you to follow a tutorial to implement the login, like https://ionicacademy.com/ionic-facebook-login/

I am using this one

The tutorial I listed too

But i use only cordova, no ionic

Made a log file. Login part starts width !!!START FACEBOOK
https://github.com/jeduan/cordova-plugin-facebook4/files/2318136/log.log

Maybe any idea what is wrong?

What cmd are you running and what are the output of these?

Don’t open issue about this in the plugin, more than probably, it isn’t a bug

I am using cmd:

cordova build android -release --info --debug

C:\games\cordova\mygame\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk mygame

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore mygame.keystore C:\games\cordova\mygame\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk mygame
del mygame.apk

C:\Users\root\AppData\Local\Android\Sdk\build-tools\28.0.0\zipalign.exe -v 4 C:\games\cordova\mygame\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk mygame.apk

I also get error
“User Cancelled Dialog (4201)”

I really wish I could help but it’s a bit too much not enough precise information, it still sound to me like “it doesn’t work period” sorry

How did you install the plugin? Did you set tup everything correctly in Facebook? Which tutorial did you follow? What are you lib and dependencies version (cordova)? How did you try? Where in a browser or android or ios?

Maybe is your project open source? In order to give a try…

I found some feature
If i run code like this
index.js

        var onDeviceReady = function() {
			facebookConnectPlugin.login(["public_profile", "email"], fbLoginSuccess, fbLoginError);
        };

        var fbLoginSuccess = function (userData) {
            facebookConnectPlugin.api(userData.authResponse.userID+"/?fields=id,name,email", ["public_profile", "email"], function(data) {
				alert("Name: "+data.name+" Email: "+data.email);
				//you may store name, id, email in sessionstorage or process it here.
            }, function(error) {
				alert(error);
            });
        };

        var fbLoginError = function (error) {
            alert(error);
        };


        document.addEventListener("deviceready", onDeviceReady, false);

Everything works fine.

The problem begins if I load whole application before calling
document.addEventListener(“deviceready”, onDeviceReady, false);
or if I make call just
onDeviceReady();

than it’s stalled with loading.

then the problem is is definitely not related to the plugin