2

I am making an app that uses the Facebook login possibility.

When I was testing the app, I used the debug.keystore to generate the key hash, I put that into the App configuration on Facebook and all worked fine. However, now that I want to put my app on Google Play, I can't use the debug keystore, so I generated one of my own. I regenerated my key hash, put that into the App configuration on Facebook and when I export the app to my phone to do some last testing, I get the message that my app is misconfigured for Facebook.

Is there anything I forgot to do or that I did wrong?

Thanks

Mats Raemen
  • 1,679
  • 1
  • 27
  • 39
  • 1
    You could try following the instructions in the 2nd comment in this answer on SO: http://stackoverflow.com/a/10516629/450534. After making that change, create a signed package using your keystore for deploying on Google Play and transfer the generated APK to your device and run it from there while still connected to the computer with DDMS running. Notice the logs generated when you run the app. If there is an error in your _Hash Key_, it will give you the correct _Hash Key_ in logcat. – Siddharth Lele Oct 03 '12 at 09:17
  • the only logs i get from Facebook-Util are: POST URL: https://graph.facebook.com/135978903106084/activities and https://graph.facebook.com/135978903106084?format=json&fields=supports_attribution – Mats Raemen Oct 03 '12 at 09:43
  • Nothing that looks like something this: _Login failed: invalid_key:Android key mismatch_ ? – Siddharth Lele Oct 03 '12 at 09:53
  • Did it by running the application in eclipse and using the debug key, I then indeed got the "login failed: invalid ..." message. apparently both keys are the same after all, must be something wrong with the way I tried to generate my key in the cmd. Thanks for your help! – Mats Raemen Oct 03 '12 at 10:08

2 Answers2

1

I have toiled for two days & got the solution at last, this is the WRONG way to get the hash key -

keytool -exportcert -alias *<your _alias_name>* -keystore *<key_store_path>* | [openssl_bin_directory]\openssl sha1 -binary | [openssl_bin_directory]\openssl base64

The RIGHT way is described here -

http://facebook.stackoverflow.com/questions/13281913/app-is-misconfigured-for-facebook-login-with-release-key-hash

or here

Facebook Android Generate Key Hash

Community
  • 1
  • 1
Khobaib
  • 1,507
  • 2
  • 19
  • 29
0

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.

Credit goes for Siddharth Lele

mtk
  • 11,504
  • 15
  • 67
  • 104