App is misconfigured for Facebook Login with Release Key Hash
I've intergrated Facebook to my App. I tested my App with Debug Key Hash was alright in emulator and my device HTC. When I tried the Release Key Hash for my signed APK , "App is misconfigured for Facebook login" error always happened in my device HTC One X.
keytool -exportcert -alias android -keystore C:\android2012\android.keystore | openssl sha1 -binary | openssl base64
I used the above-mentioned command to generate the Release key hash. The alias name is "android". It successfully generated the key hash after entering password. This key hash was input into the Facebook Dashboard and I tried to access in my signed APK but it failed.
Anyone can help? Stuck with this error for few days. Thanks a lot!
Solution 1:
Why it works on the emulator or even on the device while you are testing it is because, while testing from eclipse, you use the debug.keystore and not your release key.
Follow one of the two solutions below, and you should be good to go.
Solution 1:
Try this link: http://www.helloandroid.com/tutorials/using-facebook-sdk-android-development-part-1. I found that using the Facebook method of getting a Hash Key did not always work as advertised. This link however, has a different method of getting the Hash Key and has pretty much always worked.
Solution 2:
That being said, I always found the simplest thing to do was, let the Facebook SDK tell you what your Hash Key is. This is by far more simpler and shouldn't take more than a couple of minutes.
Step 1: In your Facebook SDK, locate the Util.java class. In that, change this:
private static boolean ENABLE_LOG = false;
to:
private static boolean ENABLE_LOG = true;
Step 2: Create a new Signed APK, transfer to your device and install. If it is already installed, naturally, it will prompt.
Step 3: With your DDMS (Logcat) running and your device connected to the computer, run the application and keep looking for a key mismatch warning. That warning has the actual Hash Key. Copy that key, go to your Facebook Developer page and add the new key to the list.
Solution 2:
I was stuck on this issue for about a week! I wanted to generate hash key for my own keystore and not the debug.keystore. I've tried every possible solution on the web...
Finally I've came to a strange understanding:
keytool -exportcert -alias androiddebugkey -keystore [PATH_TO_KEYSTORE]\debug.keystore | [PATH_TO_OPENSSL]\openssl sha1 -binary | [PATH_TO_OPENSSL]\openssl base64
using this method I was asked for the password and received a hash key (wrong one)
second method in three steps proposed here Facebook Android Generate Key Hash
keytool -exportcert -alias androiddebugkey -keystore [PATH_TO_KEYSTORE]\debug.keystore > [PATH_TO_OPENSSL]\debug.txt [PATH_TO_OPENSSL]\openssl sha1 -binary [PATH_TO_OPENSSL]\debug.txt > [PATH_TO_OPENSSL]\bin\debug_sha.txt [PATH_TO_OPENSSL]\openssl base64 -in [PATH_TO_OPENSSL]\bin\debug_sha.txt > [PATH_TO_OPENSSL]\bin\debug_base64.txt
using this method I was also asked for the password and received a different hash key = the correct one...
P.S. Put your alias instead of "androiddebugkey" and your keystore instead of "debug.keystore"