In my project, I am using facebook API for login purpose.
I got key hash error , when ever i try different account or different mobile device. Any body known this type issue. How to solve this. In below, i attached error screenshot.
Asked
Active
Viewed 649 times
-4
-
check: https://stackoverflow.com/questions/30934225/facebook-android-app-error-invalid-key-hash – Nguyễn Trung Hiếu Aug 16 '17 at 06:47
-
https://stackoverflow.com/questions/23674131/android-facebook-integration-invalid-key-hash – Nguyễn Trung Hiếu Aug 16 '17 at 06:48
-
generate the kayhash again and place it in developers.facebook.com – Sunil P Aug 16 '17 at 07:06
-
I already added the Key Hashes – Deepan Aug 16 '17 at 08:45
1 Answers
0
public void generateHashkey(){
try {
PackageInfo info = getPackageManager().getPackageInfo(PACKAGE, PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
String s = Base64.encodeToString(md.digest(),
Base64.NO_WRAP);
Log.e("HASH KEY ", s);
}
} catch (PackageManager.NameNotFoundException e) {
Log.d("Name not found", e.getMessage(), e);
} catch (NoSuchAlgorithmException e) {
Log.d("Error", e.getMessage(), e);
}
}
try to generate the hashkey then copy paste it to developer console facebook.

Shailesh Bandil
- 497
- 7
- 20
-
-
-
-
Actually as the error it self says that Invalid HashKey cos it not found in store key hashes so you have to create a hash key and than save it to your developer console – Shailesh Bandil Aug 16 '17 at 13:55
-
and the Key that your have save to the developer console and the key which is generated form the apk and checking to the console key did not matched so for that you are getting this error – Shailesh Bandil Aug 16 '17 at 13:57