facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 908 forks source link

LoginButton fails if FB app is installed [Android] #635

Closed jordangrant closed 4 years ago

jordangrant commented 5 years ago

🐛 Bug Report

If the Facebook app is installed (enabled) on the Android device, the Login button fails to log the user in on some devices.

To Reproduce

  1. Click Login Button
  2. Click continue as Name
  3. Returns to Login page with no successful login

Expected Behavior

User is successfully logged in

Code Example

<LoginButton loginBehaviorAndroid={'native_with_fallback'}/>

Environment

FAIL: SAMSUNG GALAXY 8 - ANDROID 9 FAIL: PIXEL 3 - ANDROID 9 WORKS: HUAWEI MATE 10 PRO - ANDROID 9 Edit: Had a case where it failed on Huawei and then started working again on a subsequent app install.

Mimicx commented 4 years ago

any solution?

msqar commented 4 years ago

OMG yes! It happens the same with me. I have a Huawei P20 Lite with Android 9 Pie and it works, but doesn't work on my partner's SAMSUNG Galaxy J7 with Android 8. It seems it loads up, but it's like the window is transparent, shows a little loader, then disappears.

Any workaround for this? It's a nice bug.

Gigasz commented 4 years ago

Same issue here

on my Xiaomi Redmi Note 7

Login only works if FB app is uninstalled

When installed, it opens an empty transparent dialog and closes immediately

Any fixes? I'm guessing it's something related to deep linking to the app

Gigasz commented 4 years ago

After further check, if I set the login behavior to web_only (LoginManager.setLoginBehavior('web_only')), the dialog appears, but the result from const result = await LoginManager.logInWithPermissions(['public_profile', 'email']); doest not come. Actually, the code simply stops running from that point on, it doesn't throw any errors, just stops

Gigasz commented 4 years ago

This is the log from my logcat:

2019-10-24 13:49:02.589 19348-19412/com.x.x I/Timeline: Timeline: Activity_launch_request time:575458726 intent:Intent { act=NATIVE_WITH_FALLBACK cmp=com.x.x/com.facebook.FacebookActivity (has extras) } 2019-10-24 13:49:02.617 19348-19368/com.x.x V/FA: Recording user engagement, ms: 9083 2019-10-24 13:49:02.623 19348-19368/com.x.x V/FA: Connecting to remote service 2019-10-24 13:49:02.627 19348-19368/com.x.x V/FA: Activity paused, time: 1659016665 2019-10-24 13:49:02.649 19348-19368/com.x.x D/FA: Logging event (FE): user_engagement(_e), Bundle[{ga_event_origin(_o)=auto, engagement_time_msec(_et)=9083, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-9035433487044074867}] 2019-10-24 13:49:02.650 19348-19348/com.x.x W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@9b3a153 2019-10-24 13:49:02.656 19348-19348/com.x.x V/FA: onActivityCreated 2019-10-24 13:49:02.686 19348-19368/com.x.x V/FA: Connection attempt already in progress 2019-10-24 13:49:02.686 19348-19368/com.x.x V/FA: Activity resumed, time: 1659016734 2019-10-24 13:49:02.704 19348-19368/com.x.x D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_previous_class(_pc)=MainActivity, ga_previous_id(_pi)=-9035433487044074867, ga_screen_class(_sc)=FacebookActivity, ga_screen_id(_si)=-9035433487044074865}] 2019-10-24 13:49:02.734 19348-19368/com.x.x V/FA: Connection attempt already in progress 2019-10-24 13:49:02.735 19348-19368/com.x.x V/FA: Connection attempt already in progress 2019-10-24 13:49:02.750 19348-19368/com.x.x D/FA: Connected to remote service 2019-10-24 13:49:02.751 19348-19368/com.x.x V/FA: Processing queued up service tasks: 4 2019-10-24 13:49:03.324 19348-19368/com.x.x V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 640 2019-10-24 13:49:03.329 19348-19368/com.x.x V/FA: Activity paused, time: 1659017373 2019-10-24 13:49:03.360 19348-19368/com.x.x V/FA: Activity resumed, time: 1659017410 2019-10-24 13:49:03.398 19348-19368/com.x.x D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_previous_class(_pc)=FacebookActivity, ga_previous_id(_pi)=-9035433487044074865, ga_screen_class(_sc)=MainActivity, ga_screen_id(_si)=-9035433487044074867}] 2019-10-24 13:49:08.465 19348-19368/com.x.x V/FA: Inactivity, disconnecting from the service

tejunior commented 4 years ago

My problem was solved after checking both threads (https://github.com/facebook/react-native-fbsdk/issues/633 and https://github.com/facebook/react-native-fbsdk/issues/424).

Google play says: "Google Play uses the upload certificate to verify your identity and then re-signs your release using the app signing key for distribution."

I was not using the re-sing app key. You can convert SHA-1 hash in hex format (as found in Play console) into base64 hash using next command:

echo 33:4E:48:84:19:50:3A:1F:63:A6:0F:F6:A1:C2:31:E5:01:38:55:2E | xxd -r -p | openssl base64

https://stackoverflow.com/questions/44355452/google-play-app-signing-key-hash/44448437#44448437

jordangrant commented 4 years ago

Fixed for me via these instructions https://github.com/facebook/react-native-fbsdk/issues/633#issuecomment-554335094 thanks to @tafelnl