App is misconfigured for Facebook Login with Release Key Hash

后端 未结 6 1587
陌清茗
陌清茗 2020-12-01 15:51

I\'ve intergrated Facebook to my App. I tested my App with Debug Key Hash was alright in emulator and my device HTC. When I tried the Release Key Hash for my signed APK , \"

6条回答
  •  独厮守ぢ
    2020-12-01 16:12

    Siddharth's solution 2 sometimes isn't possible in Facebook SDK 3.0 onwards. Use the following code to toast the right key hash inside your app itself.

    try {
                PackageInfo info =     getPackageManager().getPackageInfo("com.package.mypackage",     PackageManager.GET_SIGNATURES);
                for (Signature signature : info.signatures) {
                    MessageDigest md = MessageDigest.getInstance("SHA");
                    md.update(signature.toByteArray());
                    String sign=Base64.encodeToString(md.digest(), Base64.DEFAULT);
                    Log.e("MY KEY HASH:", sign);
                    Toast.makeText(getApplicationContext(),sign,     Toast.LENGTH_LONG).show();
                }
    } catch (NameNotFoundException e) {
    } catch (NoSuchAlgorithmException e) {
    }
    

    replace com.package.mypackage with your package name...

提交回复
热议问题