0
votes

Every Android app you'll create will be signed, and you will need to register each app's key hash with Facebook as a security check for authenticity.

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\DELL.android\debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -binary |"C:\OpenSSL\bin\openssl" base64

I generated hashkey through above command and updated in Facebook developer account.

SO, whenever my app is doing request to facebook, will this hashkey will be generated dynamically through Facebook SDK and will it be checked against the hashkey stored in Facebook dveoper page.

1

1 Answers

0
votes

Try this code for generate Hask key

// Add code to print out the key hash
    try {
        PackageInfo info = getPackageManager().getPackageInfo(
                "com.facebook.samples.hellofacebook", 
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }
    } catch (NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

    }