cordova-plugin-facebook4 log in and do API call in success function

338 views Asked by At

In my app I´m posting some text to facebook. This works fine if the user is already logged in with facebook. If not I´m calling this function to log the user in and directly after that do the api call:

facebookConnectPlugin.login( ["email"], function() {
    console.log("Facebook has logged in")
    facebookConnectPlugin.api(facebookString, ["publish_actions"], function(response){
        // success
        console.log("success "+JSON.stringify(response));
    }, function(response){
        // error
        console.log("error "+JSON.stringify(response));
    })
}, function(error){
   console.log(error);
});

The first console.log "facebook has logged in" is called. The second api call is not working. No success or error function console.log.

Does someone know why?

0

There are 0 answers