capacitor-community / facebook-login

Facebook Login support
MIT License
103 stars 52 forks source link

Login error on android #83

Open ghonche opened 2 years ago

ghonche commented 2 years ago

Describe the bug When I tried to login with facebook, this error occurred:

There is an error in logging you into this application please try again later. (screenshot attached.)

To Reproduce Steps to reproduce the behavior:

  1. use @capacitor-community/facebook-login to implement Facebook authentication on your app.
  2. Generate signed APK of the app.
  3. install Facebook application on an android device
  4. Install your app and try to login using Facebook on the same device.

Expected behavior Login must complete successfully.

Screenshots

photo_2022-02-20_16-30-39

Smartphone:

Additional context Please consider that the bug happens when the Facebook application is installed. And it only exists on signed apk. It is also reported in react-native-facebook-login . Also note that i've already added key hash on facebook dashboard.

rdlabo commented 2 years ago

@ghonche This may be only debug mode. Please try this: https://stackoverflow.com/questions/70506466/invalid-key-hash-facebook-login

ghonche commented 2 years ago

@ghonche This may be only debug mode. Please try this: https://stackoverflow.com/questions/70506466/invalid-key-hash-facebook-login

No, I don't think it's related to key hash. I got my release certificate fingerprint using this command: keytool -list -v \ -alias <your-key-name> -keystore <path-to-production-keystore> from this doc And then generated key hash using this command: echo <SHA1 fingerprint> | xxd -r -p | openssl base64 or this link. Then I copied and pasted this Release Key Hash into Facebook Android settings.

rdlabo commented 2 years ago

Did you try to using singed apk?? Even if the key is correct, it will be useless if the apk file is not signed. Read the implementation if you need to. This plugin is just a wrapper for the Facebook login library.

ghonche commented 2 years ago

Yeah I did sign the APK. Using Android Studio ----> Build menu ---> Generate Signed Bundle/APK... I believe the problem is not related to the wrapper plugin because as far as i know, same issue exists in ionic and react native Facebook plugins (issues here and here). By the way, I fixed this issue for myself by forcing facebook to login through web dialog. This stops the native Facebook app from interfering. It works for me. Take a look if you want: https://github.com/capacitor-community/facebook-login/pull/84

rdlabo commented 2 years ago

The difficulty with this problem is that the application I am releasing works fine on the actual device of android: https://play.google.com/store/apps/details?id=jp.rdlabo.tipsys

@ghonche Can I try Facebook login with this app? First, isolate whether the problem is with the plug-in or with the actual device.

ghonche commented 2 years ago

Hi again. I tried Facebook login in your app. It worked fine. Of course it openes a web intent for facebook login. That's how I solved the bug for myself (pull request ). The problem accures when you have Facebook app installed and a native intent opens.

rdlabo commented 1 year ago

Hi, again, and sorry for late.

I found https://github.com/magus/react-native-facebook-login/issues/297#issuecomment-433816732 , and sign key is changed at bundle.

If use "Build bundle", check SHA-1 on Google Play Console.

Thanks.

ghonche commented 1 year ago

Hi Masahiko, Thanks for following up this issue. As far as i know, sign key is changed only after android application is published. But this issue occurs no matter my app is published or not. Any how, I will take a second look at the sign key. regards

co-dax commented 9 months ago

I have fixed this by clearing mobile app cache and data.