- Home /
SHA1 Hash same as Facebook Hash? (prime31 social plugin)
hello!
i want to integrate facebook in my app, so i created a facebook app on facebook and installed the prime31 social plugin for android.
i added the package name (my app's package name) and the class name (as descriped by prime31) on the facebook developer site at my app. facebook also asks for a hash key.
my question now is: is the hash key the same i need to add in google developer console when linking an app for in app billing? (the hash key i got from my .keystore file) because i already have this key and used it to link my app for in app purchases. the key looks like "20:C0:F5:F4........"
but concerning facebook - i read some ppl wrote you have to get your hash key from the .keystore file by using keytool and some long command looking like
"keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64"
do i need to do this for FACEBOOK as this hash key is different from the one i used for google developer console? sorry i am not into all this yet and i am a bit confused... and when i start the testscene of prime31's social plugin nothing works and i only get a "valid session? false" in the debug log
yes, you get the hash key from the keystore using the command you noted.
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
If you watch the logcat log when trying to access facebook, it will tell you what is happending. SOmeething like hash XXXXXXX (Whatever hash) not found. or something like that. Also note, sometimes facebook will replace certain characters in the hash.
here is an enexample of a hash that facebook wants.
NteSLOyHHHx1-WUnrW0NEbwcY2Y=
The hash you create might look like this:
NteSLOyHHHx1+WUnrW0NEbwcY2Y=
Notice the '+' and '-' are switched.
thanks very much!
but it says i need OpenSSL.exe to use this command. i am using a mac. any alternatives? ;)
i wonder why it's so inconvenient to create this hash...
Yes, you have to install openssl, and either add it to your path (don't know the term for a mac), or place the actual address in the place of openssl.
Openssl for mac:
Answer by Dblfstr · Mar 26, 2014 at 01:26 PM
Here is a great post on how to get the proper hash for facebook. It links the proper ssl to get the correct hash (new ssl versions do not create the hash you need. Also, someone in the post made a GUI for getting the hash, I have not tried it. EDIT: The link I posted is more relevant to windows, put the process is the same on a mac.
http://stackoverflow.com/questions/4388992/key-hash-for-android-facebook-app
EDIT 2:
Openssl for mac with a little info:
http://www.itechtalk.com/thread7108.html
The method for getting the hash is what you noted.
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
That is obviously for the debug key, you replace the debug with your relevant info. NOTE: you will get a hash even if the you mistype the password, etc. Of course, this hash will not work, but it will still give you one. Real pain in the butt.
Also note, sometimes facebook will replace certain characters in the hash. Here is an example of a hash that facebook wants.
NteSLOyHHHx1-WUnrW0NEbwcY2Y=
The hash you create might look like this:
NteSLOyHHHx1+WUnrW0NEbwcY2Y=
Notice the '+' and '-' are switched.
thanks very much. i think i got all info i need now. very annoying this is so difficult. but i should work out
Your answer
Follow this Question
Related Questions
How to "Like" facebook page ? 0 Answers
Facebook plugin problems 1 Answer
Prime31: Posting To Facebook 0 Answers
A node in a childnode? 1 Answer
introducing "safe" DLL causes internal compiler error 0 Answers