3

I am suffering with Facebook login issue in my android app. If there is no Facebook app installed on android device or I use an emulator, Facebook login works properly. But if Facebook app is installed on Mobile than it gave an error.

Error in facebook lite app

Error in Facebook lite

Error in facebook app

enter image description here

I am using 2 different mobile and both gave same error. I followed this SO question : Android Facebook sample app doesn't login when FB app installed. With this SO Question I understood that this error arise after Generating signed apk in android studio. So I used signed Keystore (.jks) to generate new Key Hash. After generating new key hash I added this in facebook app>Settings>Basic But Still getting same error in Both mobiles. How can I fix this error. Thanks in advance.

Community
  • 1
  • 1
Harish Kamboj
  • 887
  • 12
  • 32

4 Answers4

1

You need configure app setting in facebook developer concole and add the generated KeyHash in KeyHash field.

keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | "PATH FOR openssl.exe" sha1 -binary | openssl base64

Password: android
Marlen
  • 146
  • 8
  • YOUR_RELEASE_KEY_PATH this is path of keystore but what i need to use here YOUR_RELEASE_KEY_ALIAS – Harish Kamboj Aug 19 '16 at 09:53
  • Standart location for debug.keystore is |~/.android/ on OS X and Linux | C:\Documents and Settings\\.android\ on Windows XP | C:\Users\\.android\ on Windows Vista and Windows 7, 8, and 10 – Marlen Aug 19 '16 at 10:01
  • YOUR_RELEASE_KEY_ALIAS is android – Marlen Aug 19 '16 at 10:03
  • i used both _android_ and C:\Users\\.android\ but still getting same error – Harish Kamboj Aug 19 '16 at 10:07
  • sorry, try this Keystore name: "debug.keystore" Keystore password: "android" Key alias: "androiddebugkey" Key password: "android" – Marlen Aug 19 '16 at 10:09
  • I m using password **android** but need to use my own android signed keystore password that I was created when generating signed apk – Harish Kamboj Aug 19 '16 at 10:17
  • If you use your own keystore - generate for it KeyHash and put it to the facebook app, and your app will be work for both version of apk – Marlen Aug 19 '16 at 12:05
1

No need to use android as your password, use that password that created during genrating signed apk

Harish Kamboj
  • 887
  • 12
  • 32
1

I fixed it by added to my FacebookHelper

LoginManager.getInstance().loginBehavior = LoginBehavior.WEB_ONLY

now login dialog opens in browser and works correctly

Kirguduck
  • 748
  • 1
  • 9
  • 20
0

use this

LoginManager.getInstance().setLoginBehavior(LoginBehavior.WEB_ONLY);

when you sign in through your app, Facebook won't allow because there are two Facebook instances(your app and Facebook app),you must enable web only in your app.