-1

i just tried facebook integration with my android application they asked for key hashes. i just want to skip the test by giving some wrong number that works so just tell me how can i proceed for next step in facebook integration. Key Hash for an android application look like whether its combination of numbers and alphabets or something

  • I think you need to read facebook documentation well, you cant skip this step as key hash is dependent on your keystore, so if you use any random hash values will not work at all. – Silvans Solanki Sep 09 '16 at 18:06

1 Answers1

0

You can't, for security reasons you need a valid KeyHash to let facebook know that the request is actually comming from your app, facebook will only authorise your app if you have a valid keyhash.

When you make a request facebook will check the signature of your app if this fails facebook will denie any access

To get the key hash you can use this, it will print in the console your hash

public void printKeyHash() {
    try {
        PackageInfo info = getPackageManager().getPackageInfo("your package name here", PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.e("SHA: ", Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
    }
}

or you can use the cmd Key hash for Facebook Android SDK

Community
  • 1
  • 1
Tiago Oliveira
  • 1,582
  • 1
  • 16
  • 31