-1

I have implemented Facebook SDK into my Android application correctly i beleive with development key hash etc and i am testing the login function. The first time i used the function, the facebook page presented me with the usual "This application would like to access your cv profile" with my picture, on clicking accept it returned me to app, success. However the second time, and from now on it shows the following error when clicking the login button.

"This app has no android key hashes configured. Configure your app key hashes at "http://developer.facebook.com/apps/28748493729"

It seems the setup has somehow forgotton my key hash after using it once, but when i visit the link provided it shows that the development key hash is still there. Am i missing the concept of how key hashes work?

Any help appreciated,

Thanks.

Ross
  • 3
  • 1

1 Answers1

0
public static String getKeyHash(Context context, String packageName) {
try {
    PackageInfo info = context.getPackageManager().getPackageInfo(
            packageName,
            PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        String keyHash = Base64.encodeToString(md.digest(), Base64.DEFAULT);
        return keyHash;
    }
} catch (PackageManager.NameNotFoundException e) {
    return null;
} catch (NoSuchAlgorithmException e) {
    return null;
}
return null;

}

use the above method to generate the hash key and the add it into facebook developer app details enter image description here

And better you use new sdk ie,Facebook sdk4

  • Thanks for your prompt response. Will give this a try now. – Ross Apr 21 '15 at 15:36
  • i faced this error when i integrating facebook into my app by generating the hash from command line using openssl and i hope this will work for you too –  Apr 21 '15 at 15:40
  • 1
    This is working, it seems this is a far better way to get a hash key than using the openssl command line alternative. thankyou very much VAISAKH. – Ross Apr 21 '15 at 16:14