Authentication error when integrating Facebook SDK 3.6 to Android

Asked

Viewed 692 times

1

I’m having difficulties to integrate Facebook SDK 3.6 to Android. When trying to log into the app, the following error appears:

Invalid Android Key Parameter

How to solve?

1 answer

1

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

For the login to work, you need to generate the hash of keystores of Keystore production.

A more detailed explanation can be found in this link (http://www.devmedia.com.br/integrando-aplicacoes-android-com-o-facebook/27567).

But a little advice: The keytool in Windows may present very boring flaws in the generation of this hash (speak this knowingly)! If you have problems to generate, 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());
}
  • Friend, where I put this code please, detail for me please. I’m sorry, because I’m still layman on the subject. Thank you very much for your attention.

  • I managed to generate, now I can’t find the place to put there in the control panel of the app on facebook!!!

  • Enter in the page of Developer from Facebook (https://developers.facebook.com/apps) and go to the app you created. Then click Options (to edit the app information). There, you will have an "Android" section and a field to insert the hash. The link I posted in the reply has an image of this process.

  • Igor, got it, but still gives the incompatible key error, error gives that the key does not match the same.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.