Wizcorp / phonegap-facebook-plugin

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

Cordova Facebook plugin randomly crashing after Authorizing button confirmation #670

Open faisalahmed opened 9 years ago

faisalahmed commented 9 years ago

Hi,

currently i am facing issue with facebook plugin..... when i try to login through FB and i successfully submit my credentials on the facebook login window than ... after authorizing the app for access my account information ... my app is crashing

i am unable to debug this issue as i dont get response from the facebook window after authorization ... and this is happening randomly (sometimes)

i had tried to debug the issue but i was unsuccessful in it

aogilvie commented 9 years ago

@faisalahmed on Android? What device and OS version? Paste you logcat output here.

ripcurlx commented 9 years ago

I experienced a similar issue every other time. Here is the NullPointerException of one of the crashes:

W/dalvikvm(27532): threadid=1: thread exiting with uncaught exception (group=0x4162cba8)
E/AndroidRuntime(27532): FATAL EXCEPTION: main
E/AndroidRuntime(27532): Process: [APP NAMESPACE], PID: 27532
E/AndroidRuntime(27532): java.lang.NullPointerException
E/AndroidRuntime(27532):    at org.apache.cordova.facebook.ConnectPlugin$10.onCompleted(ConnectPlugin.java:547)
E/AndroidRuntime(27532):    at com.facebook.Request$1.onCompleted(Request.java:303)
E/AndroidRuntime(27532):    at com.facebook.Request$4.run(Request.java:1726)
E/AndroidRuntime(27532):    at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime(27532):    at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(27532):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(27532):    at android.app.ActivityThread.main(ActivityThread.java:5001)
E/AndroidRuntime(27532):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(27532):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(27532):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
E/AndroidRuntime(27532):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
E/AndroidRuntime(27532):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  569):   Force finishing activity [MAINACTIVITY]
D/CordovaActivity(27532): onMessage(splashscreen,hide)

It seems like it the plugin doesn't get in some cases a graph object or the inner json object. I wasn't able to debug it that far.

ripcurlx commented 9 years ago

I can reproduce the bug every time when I disconnect a user manually on the Facebook page and afterwards try to re-connect the user from the same mobile session. In this case the session object looks like following:

{Session state:OPENED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:
[public_profile, email, contact_email]}, appId:[APP_ID]}

In the graph user callback the user is null and the response doesn't have a valid content, but an error:

error:{HttpStatus: 400, errorCode: 190, errorType: OAuthException, errorMessage: Error validating access token: Session does not match current stored session. This may be because the user changed the password since the time the session was created or Facebook has changed the session for security reasons.}

I'll have a look on the suggested handling of this error by Facebook and implement a fix. Will keep you updated.

ripcurlx commented 9 years ago

Fix see pull request #696

aogilvie commented 9 years ago

Update Ref : #700

brugnara commented 9 years ago

Same issue. It happens every time I remove the app from the authorized applications on my facebook.

D/AndroidRuntime(23656): Shutting down VM
W/dalvikvm(23656): threadid=1: thread exiting with uncaught exception (group=0x41766da0)
E/AndroidRuntime(23656): FATAL EXCEPTION: main
E/AndroidRuntime(23656): Process: XXXX, PID: 23656
E/AndroidRuntime(23656): java.lang.NullPointerException
E/AndroidRuntime(23656):    at org.apache.cordova.facebook.ConnectPlugin$10.onCompleted(ConnectPlugin.java:547)
E/AndroidRuntime(23656):    at com.facebook.Request$1.onCompleted(Request.java:303)
E/AndroidRuntime(23656):    at com.facebook.Request$4.run(Request.java:1726)
E/AndroidRuntime(23656):    at android.os.Handler.handleCallback(Handler.java:733)
E/AndroidRuntime(23656):    at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime(23656):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(23656):    at android.app.ActivityThread.main(ActivityThread.java:5479)
E/AndroidRuntime(23656):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(23656):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(23656):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
E/AndroidRuntime(23656):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
E/AndroidRuntime(23656):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  803):   Force finishing activity XXXX
jrm0695 commented 8 years ago

Same issue as well. Has it been fixed so far?