How to solve this facebook key hash error?

眉间皱痕 提交于 2019-12-06 18:06:10

问题


In my project, I am using facebook API for login purpose. I got key hash error , when ever i try different account or different mobile device. Any body known this type issue. How to solve this. In below, i attached error screenshot.


回答1:


public void generateHashkey(){
        try {
            PackageInfo info = getPackageManager().getPackageInfo(PACKAGE, PackageManager.GET_SIGNATURES);
            for (Signature signature : info.signatures) {
                MessageDigest md = MessageDigest.getInstance("SHA");
                md.update(signature.toByteArray());
                String s = Base64.encodeToString(md.digest(),
                        Base64.NO_WRAP);

                Log.e("HASH KEY ", s);
            }
        } catch (PackageManager.NameNotFoundException e) {
            Log.d("Name not found", e.getMessage(), e);

        } catch (NoSuchAlgorithmException e) {
            Log.d("Error", e.getMessage(), e);
        }
    }

try to generate the hashkey then copy paste it to developer console facebook.



来源:https://stackoverflow.com/questions/45706693/how-to-solve-this-facebook-key-hash-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!