0

i just implemented Facebook log in into my android application. when i try to log in with Facebook i got following exception in log-cat.

Error Log :

com.facebook.http.protocol.ApiException: Key hash oZgj_um2MGi1eYpfTqwytjLMN10 does not match any stored key hashes

I already added this key hash into my developer account app page.But still i am facing same issue.

Chirag Ghori
  • 4,231
  • 2
  • 20
  • 35
suresh
  • 414
  • 3
  • 11

1 Answers1

0

Your HashKey is wrong. It should have 28 characters while your hash key 27 characters the hashkey always ends with =. So I think you have missed it. Please check it again and Change your hashkey by generating it programatically from the following code given in Facebook Docs and defined at Facebook Integration in Android Application

PackageInfo info;
try {
    info = getPackageManager().getPackageInfo("com.example.yourpackagename", 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());
}  
Community
  • 1
  • 1
Abhishek Agarwal
  • 1,907
  • 12
  • 21