Wednesday 25 December 2013

How to create Facebook Hash Key in android ?

This is simple process  to generate Hash key and we already create  lots of time but again we forget that how to generate Hash key ? Even i am stupid one of them and again throw same query in Google. But Now i remember whole the process to generate hash key. When you start to create new Facebook application for android they ask Hash Key to validate your application.

Most of the time user confused to generate Hash key and Key Store , They confused that from where to start ? It mean which path should be use to generate key?

How to Generate android (Facebook ) Hash Key ?

Step 1 :  Download OpenSSL for Windows 


Step 2 :  Open the drive where you have install JDK. ,(in my case that is C:\)

Step 3 :  Extract your Open SSL zip here in root directory  (in my case C:\Program Files\)

Step 4 :  Copy :  JAVA > JDK 1.7.0_25 > bin

Step 5 :  Open Command prompt , Start  > Run > CMD

Step 6 : Now CMD will show User's location (in my case C:\Users\chintan >_)

Step 7 : Using Step 4 paste that copied path here and enter ,

So it looks like this C:\Users\chintan > cd  C:\Program Files\Java\jdk1.7.0_25\bin 

Enter , so that will switch to new location. So now you should be here C:\Program Files\Java\jdk1.7.0_25\bin >_

Step 8 :  Now start from here ,

  • 8.1  keytool -export -alias myAlias (set alias name any)
  • 8.2 C:\Users\chintan\.android\debug.keystore ,(Get your Debug key store path and append after alias )
  • 8.3 C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary(Get your openssl path and append after keystore path separate with "|") 8.3 C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e (append with "|")
So , whole URL should looks like ,

Step 9 : Enter if you are ready to get Hash Key :)
C:\Program Files\Java\jdk1.7.0_25\bin >keytool -export -alias myAlias -keystore C:\Users\chintan\.android\debug.keystore | C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e

9 comments:

  1. Thank you, thank u very much your article helped me a lot...
    .
    Nearly after10 days, searching over the internet I found a correct method to get the fb key..
    .
    Thank u again

    ReplyDelete
  2. Thank you so much...You are the great person for me....I found a lot to generate key, now I got it. thank you so much

    ReplyDelete
  3. This is really nice example to find facebook hash key... Really Grt work.

    ReplyDelete
  4. when i try to run in cmd
    C:\Program Files\Java\jdk1.7.0_07\bin>keytool -export -alias myAlias
    it gives error such as keytool error:java.lang.Exception:keystore file doesnot exist.

    i dont know whai t have did wrong.tell me the solution.
    Thank u.

    ReplyDelete
  5. I have attempted this operation multiple times but no one has explained it as well as you have. This worked on the first time, I tip my hat, well done.

    ReplyDelete
  6. Is this hash key for all applications ?
    What if there are two applications using facebook login

    ReplyDelete
  7. 'C:\Program' is not recognized error
    so simply write Progra~1 instead of the Program Files

    Progra~1

    ReplyDelete
  8. You need to create with different package name.

    ReplyDelete