Android app Key Hash doesn't match any stored key hashes

Facebook some how replaces +,- and / with _

So just try replacing _ with +, - and / and add that hash-key.

Hopefully it should work.


I used this to show the key when I ran my app. In my case, I was getting the incorrect key hash from the keytool command. Notice that if you enter the wrong password(purposely), instead of receiving an error an incorrect key is generated. Use this to get the correct hash and see if it matches the one the in the error log

try {
        PackageInfo info =     getPackageManager().getPackageInfo("com.package.mypackage",     PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            String sign=Base64.encodeToString(md.digest(), Base64.DEFAULT);
            Log.e("MY KEY HASH:", sign);
            Toast.makeText(getApplicationContext(),sign,     Toast.LENGTH_LONG).show();
        }
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}

Also, if for some reason the above method does not work. Try using this APK to generate the correct key hash. Remember that you have to sign it with whatever certificate you are trying to retrieve(debug or release). Install it on your testing device, and run it.

http://www.easyfacebookandroidsdk.com/download/keyhash.zip


I just discovered a bug with the Sample App key entry page: If you paste a hash key from the app without hitting Enter, and then click the "Save Changes" button, the newly entered code will disappear but the page will show a "Saved!" response message. This isn't true: it didn't save. You must hit the Enter key after pasting the hash key and then hit "Save Changes".

I saved a key including the trailing = character. That worked.