Android Facebook Api Exception - remote_app_id does not match stored id

前端 未结 2 810
攒了一身酷
攒了一身酷 2021-01-01 01:04

I have an issue as said in the title of this post. I am unable to login.

SessionState currentstate =  session.getState();

gives me

2条回答
  •  梦毁少年i
    2021-01-01 01:36

    call this below method from oncreate of your activity , it will print a hash key in logcat, add that into hash field in app setting on Facebook. try again it will work

      public void printHashKey() {
    
            try {
                PackageInfo info = getPackageManager().getPackageInfo("your.package.name",
                        PackageManager.GET_SIGNATURES);
                for (Signature signature : info.signatures) {
                    MessageDigest md = MessageDigest.getInstance("SHA");
                    md.update(signature.toByteArray());
                    Log.d("TEMPTAGHASH KEY:",
                            Base64.encodeToString(md.digest(), Base64.DEFAULT));
                }
            } catch (NameNotFoundException e) {
    
            } catch (NoSuchAlgorithmException e) {
    
            }
    
        }
    

提交回复
热议问题