Invalid key hash. The key hash 8392849ZvfdjHakw2849H245738wue0 does not match any stored key hashes. Configure your app key hashes at http://developers.facebook.com/apps/ APP-ID
If you are getting the above error message while trying to log in to an App using Facebook App then the reason is that your key hash is not correct, just regenerate it and update it on the App's Developers console.
To get the Key Hash all you need to do is just need to copy the below code in onCreate() method of your launch Activity Class and watch the output in Android Studio LogCat,
FbKeyHashSnippet.javatry {
PackageInfo info = getPackageManager().getPackageInfo(
"com.your-package-name",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("YourKeyHash :", Base64.encodeToString(md.digest(), Base64.DEFAULT));
System.out.Println("YourKeyHash: ", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Note: Just replace com.your-package-name with your app package name in the above code.
More Posts related to Android,
- Android appcompat_v7 Error retrieving parent for item: No resource found that matches the given name
- SQLite with Android Easy to Understand Tutorial that covers Select, Insert, Update and Delete
- Center align text in TextView Android Programming
- The Android Virtual Device myEmulator is currently running an emulator and cannot be deleted.
- Android Lint app_name is not translated in af (Afrikaans) am (Amharic) ar (Arabic) bg (Bulgarian)
- Android : Remove ListView Separator/divider programmatically or using xml property
- Copy Text to Android Clipboard Programmatically ClipboardManager
- How to add Newline to text in Android TextView
- How to Change Android Toast Position?
- Android AlertDialog with 3 buttons example
More Posts:
- Add scroll to div element in HTML Css - CSS
- Officially Send WhatsApp message using webpage (html) - WhatsApp
- Calculate Volume of Cone - C-Program
- Install Cygwin on Windows PC to learn Objective-C - Objective-C
- Spell check not working in Gmail : Mac OS X - Mac-OS-X
- [Soluiton] You already have the latest version of Android Studio installed - Android
- How to change Chrome Spell Check from UK English to US English - Chrome
- How to See Hidden Folders and Files on Mac OS X - Mac-OS-X
- Safari appends .html extension to files that are downloaded - Mac-OS-X
- Javascript convert text case from uppercase to lowercase - JavaScript
- Sharepoint errors were found when compiling the workflow - SharePoint
- Chessboard with pieces using pure HTML and CSS - Html
- Simple Struts 2 Tutorial in eclipse with tomcat 7 server - Java
- bash: command not found error on macOS Terminal, Linux, Unix or Windows - MacOS
- Android Studio Change SDK Path - Android