2
votes

I'm trying to implement facebook login to my app that I will publish on the playstore. To do this, we need to generate a release key hash. I tried to generate it by following the guide under the section titled "Setting a Release Key Hash". This is the command they tell us to execute (for Windows 7)

keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64

ofcourse replacing <RELEASE_KEY_ALIAS> and <RELEASE_KEY_PATH>. I'm getting the 28-character hash key. But when I try to run my app, it's giving me an error

Invalid key hash. The key hash Hhle8*********************** does not match any stored key hashes. Configure your app key hashes at http://developers.facebook.com/apps/<MY_APP_ID>

Now I know why it's an error, the key hash in the error message above isn't the same as the one generated by the command I executed (keytool -exportcert.....)

I'm new to this, and extremely confused, any help will be much appreciated. Why are the keyhashes different? I'm testing my app on a real device.

2
@Rockstart5645 just Add that generated keyhash to your Facebook App. - lazy lord
The one in the error message? Is that the correct keyhash? Will that cause any problems when I upload to the playstore? - Rockstar5645
Invalid key hash. The key hash Hhle8*********************** does not match any stored key hashes. Configure your app key hashes at developers.facebook.com/apps/<MY_APP_ID> This error message says that the key hash is not register with your facebook app.So Add that key in your facebook App - lazy lord

2 Answers

0
votes

This link may be helpful as it also shows how to generate fb hadh key using code-http://javatechig.com/android/how-to-get-key-hashes-for-android-facebook-app

-1
votes

If you're using eclipse to sign your application there's an easy way to do this.

Right click on your Project > Android Tools > Export signed application

Choose or create keystore and complete the process. At the end part where you will be ask where to store your apk. You will be given a MD5 and SHA1 hex values. Copy your SHA1 and go to Hexadecimal -> base64 string decoder

Paste it on Hex string and click convert. There will be a warning just press ok. Then you will be given a base64 keyhash that you can use.