[SOLVED] Facebook and Android Key Hash

Okay I have Facebook working on the apple side of things and am trying to get it to work for Android.

To get Facebook working with Android devices I need to set up an Android Key Hash. I thought I did it correctly but it isn’t working, so I am missing something…

From the link:
https://developers.facebook.com/docs/mobile/android/build/#sig

I am supposed to use this code to generate the Android Key Hash for my Facebook App.

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64  

I assume I am not supposed to use the debug.keystore and use the keystore for my actual game. So I did this:

keytool -exportcert -keystore mygame.keystore | openssl sha1 -binary | openssl base64  

It then asks for the password, I enter it and then get a hash key. I then put that into the facebook developer page.

Then when I do a Facebook post from my app, I get the error
“invalid_key:Android key mismatch. Your key “####################” does not match the allowed keys specified in your application settings. Check your application settings at http://www.facebook.com/developers”"

The ##### is a completely different key than the one that I got from using keytool. However, I went back to the Facebook developer page and changed it to #####. And the app now posts to Facebook with no problem.

The app is built with the same keystore that I did the keytool -exportcert on.

For kicks, I also did the -exportcert on the debug.keystore. But it also gave a completely different hash key.

I would love to be able to create the actual Hash Key that Facebook needs with keytool instead.

Anyone encounter this? Or anyone that has done it successfully could kindly list their procedure…

Thanks. [import]uid: 94868 topic_id: 23637 reply_id: 323637[/import]

i did it with the debug key to check while i am developing my game. I am having a problem though, the facebook app comes up and just says loading and does nothing else. I dont think that has anything to do with the keyhash and all the examples i saw said you could use the debug key. [import]uid: 126161 topic_id: 23637 reply_id: 94895[/import]

3DreamsGaming, thanks for the post!

It made me go back and build for the device. I then noticed the “Key Alias” field in the build dialog. For some reason I thought that was an optional setting in the keytool command. Apparently not!

I went back and redid the keytool command with the alias that I selected in the corona build settings.

keytool -exportcert -alias mygamealias -keystore mygame.keystore | openssl sha1 -binary | openssl base64  

And I am now getting the Hash Key that matches the error.

So I did not use debug.keystore. I used the same keystore I was using when I built the app.

Thanks!
[import]uid: 94868 topic_id: 23637 reply_id: 94902[/import]

@Screaming Leaf and @3 Dreams Gaming, thank you for posting this. This one went super painlessly for me.

Cheers,
Naomi [import]uid: 67217 topic_id: 23637 reply_id: 99254[/import]

what is the keystore? how to use it? m facing the same problem regarding key hash. kindly help me through to get the key hash for my android aap. [import]uid: 176812 topic_id: 23637 reply_id: 134219[/import]

what is the keystore? how to use it? m facing the same problem regarding key hash. kindly help me through to get the key hash for my android aap. [import]uid: 176812 topic_id: 23637 reply_id: 134219[/import]