Key hash for Android-Facebook app

how to generate release key hash for facebook in android
how to generate release key hash for facebook in android studio
how to get key hash for facebook android studio
how to generate key hash for facebook in android in mac
invalid key hash facebook android
sha1 to key hash
generate key hash facebook android ubuntu
how to generate release key hash in android studio

I'm working on an Android app, in which I want to integrate a Facebook posting feature. I downloaded the Facebook-Android SDK, and I got the readme.md (text file) in there, in which it is mentioned to generate the key hash for Android. How do I generate it?

Getting Started - Android SDK, This section of the tutorial explains you how to get Key Hashes for android-​facebook app. Facebook SDK integration to android require an key hash  How to Get Key Hashes for Android App Facebook Integration 1. Using OpenSSL and command prompt. 2. Using a method call from android code.

You can use this code in any activity. It will log the hashkey in the logcat, which is the debug key. This is easy, and it's a relief than using SSL.

PackageInfo info;
try {
    info = getPackageManager().getPackageInfo("com.you.name", PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md;
        md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        String something = new String(Base64.encode(md.digest(), 0));
        //String something = new String(Base64.encodeBytes(md.digest()));
        Log.e("hash key", something);
    }
} catch (NameNotFoundException e1) {
    Log.e("name not found", e1.toString());
} catch (NoSuchAlgorithmException e) {
    Log.e("no such an algorithm", e.toString());
} catch (Exception e) {
    Log.e("exception", e.toString());
}

You can delete the code after knowing the key ;)

Key hash for Android-Facebook app, Select the app module from module selection dropdown to run or debug your application. B) With Google Maps Activity: Open Android Studio; Open Your Project  How to get Release Key Hash for android app Facebook To authenticate the exchange of information between your app and the Facebook, you need to generate a release key hash and add this to the Android settings within your Facebook App ID. Without this, your Facebook integration may not work properly when you release your app to the store.

I've created a small tool for Windows and Mac OS X. Just throw in the key-store file, and get the hash key.

If you want the default debug.keystore file, use the default alias and password. Else, use your own keystore file and values.

Check it out, download the Windows version or download the Mac OS X version (Dev-Host might be down sometimes... so if the link is broken, PM me and I'll fix it).

I hope that help you guys...

Dec 31, 2014 - EDIT: Changed host to AFH. Please let me know if the links are broken

Nov 21, 2013 - EDIT:

As users requested, I added a default keystore location and a DONATE button. Feel free to use it if I've helped you. :)

How to get Key Hashes for Android App Facebook Integration , The Key Hash for your Android app with Shopgate is generated in your Shopgate Admin. If you haven't configured your Facebook Login, click I will Show you Today How to get Development Key Hashes and Release Key Hash for android app Facebook very easly You guys can use this code try { PackageInfo

The instructions currently in Facebook's Android Tutorial do not work well under Windows. Their example shows how to pipe the keytool output to openssl but if you try this under Windows the output is not valid for some reason. I found that I had to use intermediary files to get it to work properly. Here are the steps that worked for me:

Start by downloading openssl for Windows from Google.

C:\Users\Me>keytool -exportcert -alias my_key -keystore my.keystore -storepass PASSWORD > mycert.bin

C:\Users\Me>openssl sha1 -binary mycert.bin > sha1.bin

C:\Users\Me>openssl base64 -in sha1.bin -out base64.txt

After running these commands the valid hash is stored in the file base64.txt. Copy and paste this to your app settings on Facebook.

Generate Hash Key for Facebook and SHA-1 Key for Google Maps , Get Generate key hash for Facebook in android in windows XP,7,8.1,10. android application ( In which we are going to add Facebook login )  How to create Android Facebook Key Hash | Convert SHA1 key to Key Hash for Facebook Developer App Android App Development Tutorials for beginners in Telugu : https:

This is what is given at the official page of Facebook:

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

Let me break this command into fragments.

  1. Look for "keytool.exe". You can search that on the C: drive. You can find it in "java jdk" or "java jre". If you have installed multiple versions, choose any.

  2. Open a CMD prompt and go to the above directory where you found "keytool.exe".

    Clip the "exe`" and paste the above command provided on the Facebook page.

  3. You will get an error on entering this that OpenSSL is not recognized as in input output command. Solution : Download "Openssl" from OpenSSL (if you have a 64-bit machine you must download openssl-0.9.8e X64). Extract and save it anywhere... I saved it on the C: drive in the OpenSSl folder

  4. Replace the openssl in the above command in which you was getting an error of OpenSSL with "C:\OpenSSL\bin\openssl" at both the places after the pipe, "|".

  5. If prompted for a password, enter android.

And you will get your hash key. For further steps, refer again to the Facebook page.

Update Android Key Hash for Facebook Login – Support Center, How to create Android Facebook Key Hash? AndroidApps/ApplicationsMobile Development. This example demonstrates about How to create  In one of my apps I need to get data from Facebook I am doing this: I have created app ID. It logs in successfully, but after logging out, I log in, and then it gives me: What is wrong I am do

How to Generating a Development Key Hash Facebook, I tried to generate hash by using >keytool -exportcert -alias payoja Problem when Facebook App is installed on Android device #304. Closed. How to get Development Key Hashes and Release Key Hash for android app Facebook - Duration: 7:14. Get Android key hash to Facebook - Duration: 4:34. PL Rik 17,267 views.

Get Generate key hash for Facebook in android in windows XP,7,8.1 , Facebook uses the key hash to authenticate interactions between your app and the Facebook app. If you run apps that use Facebook Login, you need to add your Android development key hash to your Facebook developer profile. For the version of your app that you release to you also need to generate and set a Release Key Hash.

How to create Android Facebook Key Hash?, Questions: I’m working on an Android app, in which I want to integrate a Facebook posting feature. I downloaded the Facebook-Android SDK, and I got the readme.md (text file) in there, in which it is mentioned to generate the key hash for Android.

Comments
  • you may check this link javatechig.com/2012/12/10/…
  • check this For those who are still facing issue ,
  • Generate HashKey for debug and release mode by using this. stackoverflow.com/questions/7506392/…
  • To get the keys watch this video
  • This answer almost worked for me on Win7 x64. However, the resulting encoded cert was incorrect. Bryan Bedard's answer below will produce the correct cert value. I'm guessing the piping on windows is somehow the culprit.
  • Note for 64 bit users: this works with version openssl-0.9.8e X64 only do not use with openssl-0.9.8k X64
  • I downloaded openssl-0.9.8e X64 for my system and extracted it.It contain nothing except one file with some data. Please help me to know more.
  • the command should be executed in the bin folder of java in windows systems.
  • @HanishSharma Try leaving out the $.
  • Guys, take care, after creating the apk, the key hash is changed! because using this code u get the debug keystore hash, but when creating apk, it's another hash, gotta capture it from log after trying ur apk on emulator , then delete code and export again without this log :) - i know it's a hassle :D but for me it was easier than keytool, good luck ;)
  • Opensssl always creating issues. This method is the best one. Just create a blank app , and get the key printed, Use it. Thanks man!!
  • This is by far the easiest solution. Using the keytool command I was getting the wrong key hashes (I have no idea why, decided I didn't care enough to investigate). This worked and literally took 5 minutes to get the debug and release key hashes. +1
  • Yes Sebastien, you just need to install the signed apk on a device connect it to android studio and check the log cat, or u can show the hash in an edittext in the ui and copy it, anyway yes the hash this code produces works with the signed apk :)