Showing posts with label Android facebook Hashkey. Show all posts
Showing posts with label Android facebook Hashkey. Show all posts

Thursday 14 November 2013

Invalid android_key parameter - Facebook login | Android Facebook hash key error

Hello Droid Friends,
Today , I stuck in Facebook login Issue. I am doing facebook login in my android
application but I am getting following error:

Invalid android_key parameter. The key 26gUhN_wYCwwxenlSneyTeCY
does not match any allowed key. Configure your app key hashes at

I followed following steps:
1. downloaded openssl from here and set it in your system environment path.
2. Uses following command to generate hashkey on my pc.
      keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Acer\.android\debug.keystore"
                                 | openssl sha1 -binary | openssl base64

3. Then I created a new Facebook app  and also added the generated hashkey.

4. I got the Facebook App Id Which I am now using in my and application.

After following all above steps , still I am facing the error "Invalid android_key
parameter" . Then I go to the facebook developer site and find few new things which
comes in Facebook SDK 3.5. And Its helps me in fixing the above "Invalid android_key
parameter" Issue. There Are Two way:

Step-1. When you get this error, check the logcat it returns you a different hashkey,
so you just need to replace the previous hashkey with this one. If you did not getting
any hashkey in logcat error then step-2 helps you.

Step-2: I think this is the best way of generating hashkey bcoz it removes the dependency
of debugkeystore.No need to copy and paste the same debugkeystore on each developer
machine.Here we generate hashkey on the basis of android application package name.
Just used following code for generating the hashkey.

try  {

      PackageInfo info = getPackageManager().
           getPackageInfo(this.getPackageName(), PackageManager.GET_SIGNATURES);

      for (Signature signature : info.signatures) {

          MessageDigest md = MessageDigest.getInstance("SHA");
          Log.d("====Hash Key===",Base64.encodeToString(md.digest(), 
                   Base64.DEFA  ULT));


  } catch (NameNotFoundException e) {


  } catch (NoSuchAlgorithmException ex) {



And use this generated hashkey.This will fixed your "Invalid android_key parameter" issue.

Enjoy :)
Happy Coding... :)


Copyright @ 2013 Android Developers Blog.