I'm using PhoneGap/Cordova with the facebook plugin. Everything seems to work except for getLoginStatus who is not working as defined here and here. When called, it returns some data, but not all: it doesn't return userID nor signedRequest.
Here is the code:

userID is filled with ellipsis (...), while signedRequest is undefined.

I managed to get userID with a graph call to /me:

FB.api('/me', function(me){
if (me.id) {
var fb_uid = me.id;
}
});

I wasn't able to find any way in the documentation to get a signed_request, which I have to use to authenticate the facebook user to a remote service to whom the user already connected to with facebook (I already made a login call so user is OK).
Basically the problem is that my call to getLoginStatus returns

What do you need the signed request for?
–
AustinAlloverJun 7 '12 at 8:17

Interesting. There's obviously something very wrong with the auth response, question is where does it get messed up.. Can you use a network sniffer to check for the response from facebook?
–
Nitzan TomerJun 7 '12 at 8:31

AustinAllover: I need the signed request to pass it to my web service to create a local user there. If I don't use a signed request, I can't check on my server, using PHP SDK, if the user really is the one that wanted to be connected with my app. But the question is, why FB doesn't return userID or signedRequest if it's supposed to do so?
–
Marco OttoliniJun 7 '12 at 9:35

Nitzan: No, I can't use a sniffer because the app is running on an iPhone. But the response is interpreted by the JS SDK, so they should mess things up themselves, which could be the case indeed...
–
Marco OttoliniJun 7 '12 at 9:37

It seems it could be an issue related to PhoneGap/Cordova only: github.com/davejohnson/phonegap-plugin-facebook-connect/issues/… Nitzan, you sent me in the right direction: Facebook JS SDK differs from the static version of the SDK provided with the plugin with Cordova. So probably the response from facebook is correct, but the sdk provided is not able to deal with it...
–
Marco OttoliniJun 7 '12 at 10:30

1 Answer
1

As a background, when authentication happens using the plugin then the JavaScript SDK API calls the iOS/Android SDK to handle the authorization and then pass response auth data back to the JS part. The native (iOS/Android) SDKs do not get signed requests back to be able to pass this on to the JS. This is why it's empty.

If you use the latest plugin you should at least now be seeing the user ID. The one from June likely did not pass this back. Otherwise as a work around, you could perform a call to the /me endpoint when authentication is successful in your JS code to get the user id. See the Hackbook example that does this.