Invalid key issue for android APP to call facebook API.

Well, that’s a famerous issue in stackoverflow, story is:

  • Android developers use their own keystore to sign APK
  • And generate a key hash value to facebook APP, so that facebook will sure that’s their own android APP calling their own facebook APP.

And, may developers found the key hash they generated in Windows was wrong, they’ll get an “Invalid_Key” error message…and they have to install something like Cygwin…

In my case, I put my own keystore into 3 OS

  1. Windows7 x64
  2. Mac OSX 10.6.8
  3. Ubuntu 10.04

And using following command to generate key hash:

keytool -exportcert -alias mykey -keystore ./mykey.keystore | openssl sha1 -binary | openssl base64

All 3 OS generate totally different key hash value…!
So I was confused, it can’t be, must be something wrong…

After several hours try &  error, and STFW, I found that was because a wrong alias value given.

Now, just see what alias name of your keystore shows in Eclipse IDE, and use right alias value to generate key hash value again.

Now, 3 OS genetated same key hash value~戴太陽眼鏡
and my Android APP calls facebook API just well…微笑

HEMiDEMi 的標籤: ,,,

Invalid key issue for android APP to call facebook API. 有 “ 5 則留言 ”

    • That’s what I did:
      1. in eclipse, at Package Explorer, right click your android project
      2. Select “Android Tools" – “Export Signed Application Package"
      3. Click [Next]
      4. Click [Browse] to select your keystore file, and type your password of keystore
      5. Click [Next]
      6. Now the correct Alias name will shows on a drop-down list

      Hope it helps~


在下方填入你的資料或按右方圖示以社群網站登入: Logo

您的留言將使用 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )


您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s