Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phonegap-plugin-facebook-connect: no callback function after FB.Login

Hello I've a problem with the phonegab facebook plugin, the FB.login seems to work correctly with Facebook App installed, it ask me to authorize my app, but after my confirmation to the question it not call my callback function and seems to freeze. I've this log in the console

07-12 14:29:41.742: D/DroidGap(10814): Incoming Result

07-12 14:29:41.742: D/DroidGap(10814): Request code = 64206

07-12 14:29:41.742: D/DroidGap(10814): We have a callback to send this result to

07-12 14:29:41.750: D/DroidGap(10814): Resuming the App

I'm using cordova 2.7.0 and the last version of plugin. I follow the step from the facebook documentation, the same procedure in iOS work correctly. This is my FB.Login code:

FB.init({ appId: "123074627XXXXX", nativeInterface: CDV.FB, useCachedDialogs: false });

console.Log('1');
        FB.login(function(response) { 
console.log('2');
             FB.api('/me', function(response) {
                ………..
             });        
    }, {scope : 'email'});          

the console prints 1 but not the second (2);

could you help me?

like image 878
MatteoC Avatar asked Nov 03 '22 18:11

MatteoC


1 Answers

Put this:

Log.e("Facebook login error",state.toString());

on your ConnectPlugin.java, just like this:

openRequest.setCallback(new Session.StatusCallback() {
    @Override
    public void call(Session session, 
        SessionState state,
        Exception exception) {
            Log.e("Facebook login error",state.toString());
            onSessionStateChange(state, exception);
        }
});

This will show you the facebook error (maybe "CLOSED_LOGIN_FAILED").

like image 70
user2453607 Avatar answered Nov 09 '22 15:11

user2453607