Phonegap-plugin-facebook-connect: Login not working

this.FBlogin = function() {
    console.log("TEST");

    FB.login(
            function(response) {

                console.log(response);

                if (response.session) {
                    console.log(response.session);
                } else {
                    console.log('not logged in');
                }
            },
            { scope: "user_about_me, user_activities, user_birthday, user_hometown, user_interests, user_location, user_religion_politics, user_status, user_website, offline_access, email" }
    );
}

      

Only TEST is printed in logCat:

02-01 00:09:30.616: D/CordovaLog(1489): file:///android_asset/www/js/cdv-plugin-fb-connect.js: Line 24 : Cordova Facebook Connect plugin initialized successfully.
02-01 00:09:30.616: I/Web Console(1489): Cordova Facebook Connect plugin initialized successfully. at file:///android_asset/www/js/cdv-plugin-fb-connect.js:24
02-01 00:09:32.096: D/DroidGap(1489): onMessage(spinner,stop)
02-01 00:09:33.907: D/(1489): HostConnection::get() New Host Connection established 0x93e9038, tid 1526
02-01 00:09:48.106: D/CordovaLog(1489): TEST
02-01 00:09:48.106: D/CordovaLog(1489): file:///android_asset/www/js/auth.js: Line 148 : TEST
02-01 00:09:48.106: I/Web Console(1489): TEST at file:///android_asset/www/js/auth.js:148
02-01 00:09:48.185: D/dalvikvm(1489): GC_CONCURRENT freed 56K, 2% free 10199K/10375K, paused 4ms+3ms
02-01 00:09:48.386: D/DroidGap(1489): Paused the application!
02-01 00:09:48.386: D/CordovaWebView(1489): Handle the pause
02-01 00:09:49.025: I/dalvikvm(1489): threadid=3: reacting to signal 3
02-01 00:09:49.055: I/dalvikvm(1489): Wrote stack traces to '/data/anr/traces.txt'
02-01 00:09:49.145: W/EGL_emulation(1489): eglSurfaceAttrib not implemented
02-01 00:09:49.595: D/OpenGLRenderer(1489): Flushing caches (mode 0)
02-01 00:09:55.026: D/DroidGap(1489): Resuming the App

      

I see that I am being redirected to the FB app, but I only see the AppId in the top bar and some sort of alert box that says "facebook". Is my application suspended and after returning, no success handler is called? Anyboby knows why? Or how to debug?

PS AppId added correctly to strings.xml file. The key hash was generated and added to the FB, as well as the package and class name. Did I miss something?

PPS Usage: Phonegap 2.2. and the corresponding branch phonegap-plugin-facebook-connect lib: https://github.com/davejohnson/phonegap-plugin-facebook-connect/tree/cordova-2.2-facebook-android-3.0

+3


source to share


4 answers


The good thing is that this is also an area related issue. After the change, only the success function is called back to email.

{ scope: "email" }

      

see also: https://github.com/davejohnson/phonegap-plugin-facebook-connect/issues/240

Attention, examples are outdated:



response.session

      

use the following instead:

response.authResponse.accessToken
response.authResponse.session_key
response.authResponse.expiresIn
response.authResponse.userId
response.authResponse.sig
response.authResponse.expirationTime
response.status

      

This is OAuth2 handling: see https://developers.facebook.com/blog/post/2011/07/21/updated-javascript-sdk-and-oauth-2-0-roadmap/

+7


source


Are you using the Phonegap Build / Build Facebook Plugin?

Are you calling FB.init () correctly before any other Facebook calls?



Are all your scopes listed correctly?

+2


source


{scope: "email"} you must include a callback, otherwise it will fail. Here is a working example for that

facebook connect with cordova cli 3.3

0


source


I followed all the steps, the first prefix of the login to work.

After logging in, the application is not working and when its relanuched I get the Invide android_key error.

Hash keys are configured in the FB app. I am using Phonegap Build 3.0

0


source







All Articles