Invalid Key hash facebook android sdk

后端 未结 1 851
心在旅途
心在旅途 2021-01-03 15:48

I\'m trying to use Facebook Android SDK to develop a simple app with the Facebook Login Button. But i\'m having trouble with Key Hashes. I\'ve created both a debug key and a

相关标签:
1条回答
  • 2021-01-03 16:22

    When you get Invalid key hash, it also shows the correct key hash and says "The keyhash XXXXX didnot match with any of the stored keyhashes" . so copy that displayed keyhash and append "=" at the end as XXXXX= and add it in the key hash section. Hope it works....enter image description here

    this might also work

    public static void showHashKey(Context context) {
        try {
            PackageInfo info = context.getPackageManager().getPackageInfo(
                    "com.example.me", PackageManager.GET_SIGNATURES); //Your package name here
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                Log.i("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
                }
        } catch (NameNotFoundException e) {
        } catch (NoSuchAlgorithmException e) {
        }
    }
    
    0 讨论(0)
提交回复
热议问题