Authentication error when integrating Facebook SDK 3.6 to Android

1

I'm having a hard time integrating Facebook SDK 3.6 into Android. When trying to login in the app, the following error appears:

  

Invalid Android Key parameter

How to solve?

    
asked by anonymous 25.02.2014 / 01:16

1 answer

1

This error happens because the key that is trying to access the Facebook sdk is not registered in the application (Facebook) console .

For the login to work, you need to generate the hash of the debug keystores and the keystore .

A more detailed explanation can be found in this link (<

But a little advice: keytool in Windows can present very annoying failures in generating this hash (I am aware of this)! If you have problems generating, you can use the following code:

try{ logger.debug("Checking signs");
    PackageInfo info = getPackageManager().getPackageInfo(this.getPackageName(), PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        logger.debug(Base64.encodeToString(md.digest(), Base64.DEFAULT));
    }
} catch (NameNotFoundException e) {
    e.printStackTrace();
    logger.debug(e.getMessage());
} catch (NoSuchAlgorithmException e) {
    e.printStackTrace();
    logger.debug(e.getMessage());
}
    
25.02.2014 / 01:26