Generate Key Hash For Facebook Integration Android

Posted By admin On 15.12.20

A protip by leomindez about android, facebook, androiddeveloper, and mobile. February 25, 2016 18:45. Last Updated: February 25, 2016 2.518K leomindez. Generate key hash for Android Facebook Login. Android facebook androiddeveloper mobile. When you activate a new app in Facebook for android you will need a key hash. Yes, you can also generate the Key Hash using the SHA1 of your project. Key Hash is nothing new it is just the encoded format of your unique SHA1 which Facebook prefers. If you are using the Debug SHA1 then this Key Hash will become the Debug Key Hash and if you are using the Release SHA1 then it will become the Release Key Hash. Apr 10, 2020 When it prompts you for a password, type android and hit Enter Copy the value printed in the terminal that ends with an “=” and paste it in the Key Hash field in Facebook. Then click the Save. Setting a Release Key Hash. 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.

hello all in one of my app I need to get data of fb… I am doing that. Download mendeley plugin for mac.

I have created app ID it log in successfully but after log out i Log In then it gives me

Jul 08, 2015 Generate a key hash for Facebook integration with android using openssl 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. Feb 22, 2017 one of the main step of the Facebook Integration is to get release key hashes.the main steps are given below. Download Openssl  from  here   and create a folder Openssl in C drive and extract it. Open the command prompt and go to Keytool.exe path. May 08, 2016  Simplest easiest method to access find key hash in windows step by step tutorial for beginners. The key hash is a type of simple authenticate key generate by your android development enviournment which will authenticate our developed android application ( In which we are going to add Facebook login ) and gives us the access to use Facebook login into our app.

What is wrong I am doing? Please suggest I am using Facebook sdk… I have installed Facebook in my phone… this running good in emulator that does not have inbuilt Facebook application installed

this is my code

Answers:

The generate hash key is wrong. You may get the hash key using two steps. One is through command prompt. Another one is through coding. Hash key through command prompt working on first time only. I don’t know the reason. I have also got the same problem. So i tried it through programatically.

Follow this steps:

Paste the following code in oncreate().

Modify “com.example.packagename” with your package name in the above coding without fail(You may found your package name in Android Manifest file).

Run your application. Go to the activity where you pasted the above code. In the logcat search for “KeyHash”. You may found a key hash. Copy the key hash and go to Facebook application dashboard page. Go to settings and enter the details like in the bellow image.

Once you finished the above step. Relaunch the app again you may now log into the facebook.
For more details about key hash check the link

If you add a wrong information in the settings page means it will give some error. so use the correct information there. And also if public(other than you) need to use your application means you need to enable the permission(change 'yes' in the 'Status & Review' next to setting).

Answers:

If you are facing this problem then put this key into your developer.facebook.com

Then make sure your app is live on

This green circle is indicating the app is live

If it is not then follow this two steps for make your app live

Step 1 Go to your application -> setting => and add Contact Email and apply save Changes

Setp 2 Then goto App Review option and make sure this toggle is Yes i added a screen shot

Note: If you want to copy hashkey check the BlueServiceQueue in Logcat.

Answers:

I got the same problem.I was sure that it was due to very small fault and yes it was!!!!
I found the solution.

When generating debug hash key in my computer, I entered the password of my system.But the password should be the following –
Enter keystore password: “android”
This was the only problem in my case.

—– For generating Debug key hash, use this command –

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

—– To Generate Release key hash, use this command –

keytool -exportcert -alias “alias of keystore” -keystore “Your path to the keystore when signing app” openssl sha1 -binary openssl base64

Provide your keystore password after executing this command.

Answers:

I experienced the same problem. I made a short research on the possible reasons for this strange behavior and I found the following:

  • During the first execution of a new Facebook app, it will allow connection/login even if you don’t specify any key hashes.

  • For me, the tutorial which Facebook provided didn’t generate the correct key hash, because it was giving the wrong configuration. When executing:

make sure you check all properties – the HOMEPATH, the existence of the keystore, etc. Maybe you also have to provide password.

  • What generated the proper configuration was the solution suggested by @Mahendran.

  • Also, if you see the error originally posted (http://i.stack.imgur.com/58q3v.png), most probably the key hash you see on the screen is your real one. If nothing else works, try inputting it in Facebook.

I got all those results with: Windows 7 64-bit edition, Android Studio 1.2.2, JDK 7.

Answers:

If you are using Google Play App Signing:

Open App signing section in Google Play Console, and get SHA1 of app signing certificate, than convert it to base64, for example with this tool: http://tomeko.net/online_tools/hex_to_base64.php?lang=en

Answers:

According Facebook Login for Android, you must provide the Key Hash value. In order to obtain it, you will need the key used to sign your application.

Answers:

I tried all of the above and nothing helped my case with my clients!
Than my client remembered he had the Facebook App installed on his device.
After he removed it the login worked perfectly.
The hashkey has been changed and I’ve replaced the old hash keys at Facebook Developers Console with the key from the error (as suggested above) and it works!
The Facebook App itself might be the issue, so you better figure this out on a device with the Facebook app installed and on a device with the Facebook app not installed and handle both cases.

Answers:

paste the following code into your OnCreate Method

Just modify the package name.Then go to your Log cat and select Debug search here then you will find the hash key. Now copy this hash key and then go to developer.facebook.app_id site then edit your hash key then press save. Now run your android project again I think issue will be resolved.

Answers:

I was having the same problem. First login, just fine, but then, invalid key hash.

Even though this is not a Unity thread, I found my answer here. So I will leave my answer, just in case someone else (strayed like me) stumbles upon it.

Facebook SDK for Unity gets the wrong key hash. It gets the key from “C:Users”your user”.androiddebug.keystore” and, in a perfect world, it should get it from the keystore you created in your project. That’s why it is telling you that the key hash is not registered.

As suggested by Madi, you can follow the steps on this link to find the right key. Just make shure point them to the keystore inside your project, otherwise you won’t get the right key.

Answers:

After a long research, we found a solution.

We had set permissions as:

loginButton.setReadPermissions(public_profile email);

This worked for the first time, but when we re-logged in to FB, it gave the Invalid Hash Error.

The simple solution was to change the above line to:

And it worked like a bliss!

Hopefully this helps someone.

Facebook should return the correct exception instead of the misleading invalid hash key error.

Answers:

This code will give you your hash for facebook but you have to follow these steps in order to get the release condidate hash .
1. copy and paste this code in your mainactivity

  1. generate signed apk.
  2. connect your phone to laptop and make sure it stays connected .
  3. install and run the apk in your phone by manually moving the release apk to your phone.

  4. now look at android logcat (use filter KeyHash: ) you should see your release hash key for facebook . simply copy and paste it in your https://developers.facebook.com/apps it’s under settings.

  5. now you can test the app it should work perfectly well.

    good luck.

Answers:

I had the same problem when I was debugging my app. I’ve rewrited the hash that you have crossed out in the attached image (the one that Facebook says is invalid) and added it in Facebook’s developers console to key hashes. Just be careful on typos.

This solution is more like easy work-around than a proper solution.

Answers:

This may help some one with same problem

  1. Generate key hash using below code

keytool -exportcert -alias <your_keystore> alias -keystore <your_keystore_file> openssl sha1 -binary openssl base64

2.Paste it in required field in facebook developer

3.In android studio File->Project Structure

add signing parameters

4.Select flavors

select signing config we created

5.select build type

6.select build varient and build it

Answers:

What facebook used is not the default password and alias for debug. You need to change it following and it will work.

If you have not change anything with default password it should be android.
You can also configure it in the build.gradle file. But the same alias password should be used for generating hash.

Answers:

You must create two key hashes one for Debug and one for Release. /windows-xp-professional-service-pack-3-product-key-generator.html.

For Debug key hash:

On OS X, run:

On Windows, run:

For Release key hash:

On OS X, run: ( Replace what between <> with your values )

On Windows, use: ( Replace what between <> with your values )

Answers:

Guys here is a lot of right answers. Just one thing. Paste received hash into Application -> Settings -> Main not via fast start tutorial.

Answers:

Use below code in onCreate() method of your activity

Run this code, this will generate Hash key. copy this KeyHash in Facebook application setting –> Save changes. then Log in your application. this will work perfectly in future too.

Tags: android, facebook, hash

I’m trying to obtain the key hash for integrating facebook into my Android app. But all over the net I can’t find the way to do it on MAC OS X, only for Windows.

If someone could light me with the proper way to obtain the key hash I’d really appreciate it.

Thank you!

How to&Answers:

Sorry, what key tool?

If you want to generate a Facebook App ID/Key, go to https://developers.facebook.com/apps and create a Facebook app.

If you want the keytool that you can use to create certificates etc, that is included in the jre.

Generate key hash for facebook integration android phone

Explanation for how to deal with the keys and hash here:
http://developers.facebook.com/docs/guides/mobile/#android

Answer:

I used following steps to generate a Key Hash for my app in facebook: (I am using Mac OSX 10.8)

  1. First open a terminal (open a command prompt in windows).
  2. Navigate in the terminal to the directory where your Android debug.keystore is stored.
  3. Mostly it will located under “/Users/user_name/.android/” (In Windows will be C:Documents and Settings.android).
  4. Once you are in the “.android” directory, run the following command.

    keytool -exportcert -alias androiddebugkey -keystore debug.keystore openssl sha1 -binary openssl base64

  5. When it prompts you for a password, type android and hit Enter

  6. Copy the value printed in the terminal that ends with an “=” and
    paste it in the Key Hash field in Facebook. Then click the Save
    Changes button.

Reference: Integrate Facebook logins in your Android app

Answer:

Please follow below steps to find debug.keystore and generate key hash for android development at mac.

  1. Open terminal

  2. Type cd ~/.android and hit enter to go to .android directory

  3. If you want to open .android directory in finder, type open . and hit enter. Then .android directory will be opened in finder where you can find debug.keystore. If you do not want to open .android directory and only want to generate key hash, then skip this point and follow #4.

  4. In terminal where you are already in .android directory type

    keytool -exportcert -alias alias_name -keystore sample_keystore.keystore openssl sha1 -binary openssl base64

    and hit enter.

  5. You are asked for password. Enter android as password and hit enter. Then you get key hash ending with “=”

  6. Copy key hash,enter in your facebook app setting page and save changes.

Answer:

Never did it on Mac before, but here are some advices:

1.You need OpenSSL. Install it. In Windows I just extract zip file, then copy three file include openssl.exe in bin folder to jdk’s bin folder (where keytool is), don’t know how it work on Mac.

2.Copy file keystore what you want to get key hash to jdk’s bin folder. My keystore is debug.keystore (because I’m still in test, I don’t want to use the main keystore).

Generate Key Hash For Facebook Integration Android Tutorial

3.Using command line to go to jdk’s bin folder (In Windows, I just Run -> cmd -> type cd %JAVA_HOME%)

4.Type this command:
keytool -exportcert -alias alias_name -keystore sample_keystore.keystore openssl sha1 -binary openssl base64

In my case (debug.keystore):
keytool -exportcert -alias androiddebugkey -keystore debug.keystore openssl sha1 -binary openssl base64
then enter password for debug.keystore: android (without password, the key hash’s still generated and the same as with password, don’t know why).

Generate Key Hash For Facebook Integration Android App

You’ll get some string with “=” character at the end. Go to your app setting -> mobile -> fill that key hash (include “=”) to Android key hash.

Generate Key Hash For Facebook Integration Android Software

Answer:

(honestly, not an answer, just a note for all visitors having this or similar trouble)

There is a way to obtain a key hash without JDK and OpenSSL by using pure Java utility android-fb-keytool. You can checkout and build source code.

Generate Key Hash For Facebook Integration Android Free

Tags: androidandroid, facebook, hash