1

I need a help. I am trying to integrate Facebook to my android app so that the users can log in using Facebook. The app runs perfectly on emulator but giving error on real devices. I am getting

Invalid android_key parameter. The key does not match any allowed key

Can Any one help me out to solve this problem?

Thanks in advance.

suresh kumar
  • 193
  • 1
  • 10
  • can you post the relevant logcat lines? – Gil Moshayof Sep 25 '13 at 07:37
  • Logcat doesn't shoes any error. the error displays in device. – suresh kumar Sep 25 '13 at 07:41
  • are you sure? that sounds strange... if there's a problem with the facebook sdk, it usually prints out something to the log. I assumed you're using the standard android facebook sdk issued by facebook... – Gil Moshayof Sep 25 '13 at 07:42
  • @sureshkumar have you updated keyhash of your system in facebook developer app console properly?? – Madhu Sep 25 '13 at 07:54
  • I was getting error in AdMob while using the Facebook SDK 3.0. Then i tried changing the Facebook SDK, now m not getting any error in AdMob. The SDK which i use now is been downloaded from this link http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/ – suresh kumar Sep 25 '13 at 07:55
  • @sureshkumar follow this link https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/ and download sdk from http://developers.facebook.com/docs/android/ and get the keyhash programatically – Madhu Sep 25 '13 at 08:38
  • Thanks to all for your response. I had found whats wrong with my app. I had given the wrong keyhash in the developer settings. Now i replaced it with the correct keyhash and the app works fine in the emulator but not gives any response when i run it in the real device. – suresh kumar Sep 26 '13 at 05:58
  • Thanks @Madhu. I did the same thing. I got the key by using some java code and the app works fine in emulator but no response in real device. – suresh kumar Sep 26 '13 at 06:02

4 Answers4

0

Just a shot in the dark.

Developers use to forget indicating the Android hash key in the developer settings of their FB account.

Stéphane Bruckert
  • 18,252
  • 10
  • 81
  • 113
0

Check the below links that are related to the issue.

App is misconfigured for Facebook login: Android Facebook integration issue

https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/

Community
  • 1
  • 1
Jocelyn
  • 356
  • 3
  • 5
0

I think your problem is about hash key.

You may forgot to put android key hash in developer settings in your Facebook app. Or you may put a wrong one.

user2870
  • 467
  • 6
  • 18
  • Yes exactly that was the problem. The key that i provided was the wrong one. Now i had provided the correct key and the app works fine in emulator but fails to work in real device. I am not getting any error in the log but couldn't log in using facebook. – suresh kumar Sep 30 '13 at 13:50
0

I think hash key problem ,, use this code to get hash key...

 private void getKeyHash() {
    try {
        PackageInfo info = SplashActivity.this.getPackageManager()
                .getPackageInfo(SplashActivity.this.getPackageName(),
                        PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Logger.e("KeyHash:",
                    Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
    }
}
sillicon46
  • 41
  • 1
  • 9