I have signed my app and exported it to a folder on my desktop called app in this folder is my app itself and the keystore. How do i find the key hash that i can copy into the facebook developers page. i have openssl installed but cant seem to generate the key hash ive tried many other threads on stack and none have seemed to help, thanks
James
Click "Show Advanced Settings", and in the "Device Settings" tab, under "Android", fill the "App Package Name" with your application's package name, and the "Key Hashes" field with the SHA256 value you copied.
You will have to enter a password. The password is: android. A code will come up and that code is your key hash.
Signature of a keystore Note that if you are using Play App Signing, your upload key may differ from the key used by Google Play to sign your app. In this case, you can find the app signature from the Google Play Console on the Release > Setup > App Integrity page.
C:\Users\Selvin\Desktop\selvin.kp
selvin
C:\Program Files\Java\jdk1.6.0_22\bin\keytool.exe
C:\OpenSSL-Win32\bin\openssl.exe
Then, you should call:
C:\Program Files\Java\jdk1.6.0_22\bin\keytool.exe" -exportcert -alias selvin -keystore c:\users\selvin\desktop\selvin.kp | C:\OpenSSL-Win32\bin\openssl sha1 -binary | C:\OpenSSL-Win32\bin\openssl base64
Replace my path and alias with proper ones.
Then you should see:
Enter keystore password:
Enter your password and you should get something like this: NfhDlIH7XWJzUZRjL+pZySrMX1Q=
EDITED: NfgDlIG7XWJzUZRUL+bZySrMX1Q=
<- is a bad hash. Or you got so lucky that your key made the same collision as
error:keytool error: java.lang.Exception: Alias does not exist
If hash not working:
First, call
C:\Program Files\Java\jdk1.6.0_22\bin\keytool.exe" -exportcert -alias selvin -keystore c:\users\selvin\desktop\selvin.kp
Type password and read the error
If you don't remember your alias keytool error: java.lang.Exception: Alias <selvinn> does not exist
I used selvinn to show error.
For a list of all your entries/aliases:
C:\Program Files\Java\jdk1.6.0_22\bin\keytool.exe -list -keystore c:\users\selvin\desktop\selvin.kp
second edit
For those still struggling I have found that these steps when followed correctly will certainly work but they can be quite challenging to get right first time, and actually I have found that sometimes the base64 conversion of the fingerprint when dealing with some alias' do not work (the hash gets truncated for some reason). I've written various batch files that pull most of these instructions already mentioned together so I don't rule out a problem there.
However, essentially most people fall down at the openssl stage (either can't find it, don't know how to use it, or Windows piping doesn't correctly chain the output from the SHA1 export to the base64 conversion input).
To get around this you can use an alternative method which is probably easier to follow and understand. Essentially what the facebook API wants is the base64 representation (encoding) of the SHA1 hash used to fingerprint your APK. To do this you can just list the keystore:
"C:\Program Files\Java\JRE6\Bin\keytool.exe" -list -v -keystore "Path-to-your-keystore" -storepass "KeystorePassword" > somefile.txt
Obviously you need to change the path to the keytool executable according to your own setup, and replace "Path-to-your-keystore" and "KeystorePassword" with your keystore path and password! The result should be the creation of a file "sometext.txt" in the current folder which you can then open in any text editor. The text file will list all of the keystore alias' and their respective MD5 and SHA1 hashes as hex strings.
Now just find the alias used to sign your APK, copy the SHA1 hash, and use any online hex to base64 converter to convert it to the base64 encoding format that facebook requires. You can find an online converter by googling "online hex to base64 converter". I've been using this one as you can just copy and paste the string right from the text file in to the box provided and it will just remove the colons that separate each hex byte.
One final point (somewhat obvious but..) only copy and paste the hex string and NOT the SHA1: prefix!
Hope this helps someone; it certainly works for me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With