Darko Romanov
Darko Romanov

Reputation: 2805

Facebook plugin fails on Phonegap Cordova 2.3.0

I'm having such a big headache trying to use the Facebook plugin of Phonegap Cordova 2.3.0 on Android

I've installed the last Facebook Android SDK (3.0) and it works fine as I'm able to launch the examples and they work.

But I'm not so lucky with Phonegap because neither the examples are working, the problem is that when calling this:

FB.login(
 function(response) {
     //NEVER FIRED !!
     alert(JSON.stringify(response));
     if (response.session) {
         alert('logged in');
     } else {
         alert('not logged in');
     }
  },
  { scope: "email" }
);

when I click on login button I call the FB.login and a dialog is shown asking permission to read user personal data. When I click "ok" the dialog disappear and nothing else happens.

I tried to debug the plugin (ConnectPlugin.java) and I see it correctly calls the method:

public PluginResult execute(String action, JSONArray args, final String callbackId)

and all parameters seem to have correct values. When the plugin makes the call I get this JSON:

{Session state:CLOSED_LOGIN_FAILED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[]}, appId:xxxxxxxx}

in the following method:

onSessionStateChange(SessionState state, Exception exception)

I can't understand where is the problem... whet is this code CLOSED_LOGIN_FAILED ?

Upvotes: 0

Views: 470

Answers (1)

Darko Romanov
Darko Romanov

Reputation: 2805

Well, the solution is so trivial that I am ashamed... I didn't set up the Android section on the Facebook App configuration!

Upvotes: 1

Related Questions