Wizcorp / phonegap-facebook-plugin

The official plugin for Facebook in Apache Cordova/PhoneGap
Other
1.9k stars 2.01k forks source link

facebook and phonegap 1.0.0 1.1.0 #56

Closed ghost closed 12 years ago

ghost commented 12 years ago

Hi Dave,

I'm trying to integrate your facebook plugin. However, I am getting the same error as was mentioned in issue #51

When I click login, everything looks alright, no errors. However, when I try to click me, I get:

"{"message":"An active access token must be used to query information about the current user.","type":"OAuthException"}"

I have tried to deploy with phonegap 1.1.0 and 1.0.0 too.

Do you know what could be a problem?

Thank you for your help.

Regards Lubo

holm0563 commented 12 years ago

I'm getting the same problem

tb commented 12 years ago

I get the same error.

To get more details I added e.printStackTrace(); to onFacebookError callback:

    public void onFacebookError(FacebookError e) {
        Log.d("FB", "facebook error");
        e.printStackTrace();
        this.fba.error("Facebook error: " + e.getMessage(), callbackId);

    }

Here is the error:

D/FB ( 517): facebook error W/System.err( 517): com.facebook.android.FacebookError: Failed to receive access token. W/System.err( 517): at com.facebook.android.Facebook$1.onComplete(Facebook.java:311) W/System.err( 517): at com.facebook.android.FbDialog$FbWebViewClient.shouldOverrideUrlLoading(FbDialog.java:133) W/System.err( 517): at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:216) W/System.err( 517): at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:323) W/System.err( 517): at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err( 517): at android.os.Looper.loop(Looper.java:123) W/System.err( 517): at android.app.ActivityThread.main(ActivityThread.java:3683) W/System.err( 517): at java.lang.reflect.Method.invokeNative(Native Method) W/System.err( 517): at java.lang.reflect.Method.invoke(Method.java:507) W/System.err( 517): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) W/System.err( 517): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) W/System.err( 517): at dalvik.system.NativeStart.main(Native Method)

tb commented 12 years ago

This is problem with offline_access permission which results in token expiry is 0.

I have removed offline_access, created new Facebook app, added new aid and FB plugin is working again. See http://stackoverflow.com/questions/7711097/android-facebook-app-access-token-expiry-expires-in-is-always-0

filmaj commented 12 years ago

Should not be an issue anymore with latest updates.

dokterbob commented 12 years ago

@filmaj This issue seems to be still standing: for tokens with the offline_access permission, the expiration time is still 0.

emibap commented 12 years ago

Hi guys. I think that this issue remains. I've followed every setp installing the plugin and setting a new project with the simple example. I can login without trouble, but when I click on the "Me" button I get the message requesting an active access token... From what I can see there's no offline_access permission in the example, so it must be another thing.

Moreover, when I login I can see that a token has been generated: 03-14 17:28:27.011: D/ConnectPlugin(358): Bundle[{access_token=AAADI9VGWIWQBAKZCaLOfEhOTktn4rQ3I0dRprx8r5jwn4LLAeNYfNDBZA4vOIM7XLOB4xdTZBH1M1Hpevf3YAiwcOYh2TD8uHIB2PmVsQZDZD, expires_in=5179361, code=AQCy-Jr2XYYtdqMj4lAV_Jn089msUxN4dsucJu99kG2DoEFsd16bx0frXA1KKDCxsHweF1TJKXJlvMO3rGAH5q9YnpatYW-CkpzAck2zR_wYy7XEqqvoPs6JoEhwN5Q36T74DkXF0xLUAL8kbf4ybsA2UoJJLekCNdFXPwZ8kUWqo7WUJQf5CgQ8tdwwGtAEOvk}]

I don't know if it is a valid one or if it's not saved anywhere, because calling FB.getAccessToken() returns null.

I'm using cordova-1.5.0 in an android platform using eclipse

Thanks

odbol commented 12 years ago

I think I've fixed this for Android in Phongap1.4.1. It's a different issue where the new SDK is expecting "authResponse" but getting "session" from the plugin. Here's a quick patch: https://github.com/odbol/phonegap-plugin-facebook-connect/commit/0ef84e29603338930ff82fc6d6ef8525b668077d

Submitting pull request now.

EmilioBravo commented 12 years ago

@odbol fix worked for me, check my comments at his commig

emibap commented 12 years ago

It worked for me too. Thanks!