Android Facebook Api Exception - remote_app_id does not match stored id

非 Y 不嫁゛ 提交于 2019-12-18 13:35:13

问题


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

SessionState currentstate =  session.getState();

gives me a state CLOSED_LOGIN_FAILED. I took a look at this post, Android Facebook SDK 3.0 gives "remote_app_id does not match stored id" while logging in

I generated a key using the keytool and put that in the App Dashboard. But that does not seem to help. Any help on this appreciated


回答1:


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) {

        }

    }



回答2:


I know this has already has a selected answer, but it is important to note that if you are trying to use keytool instead of printing the keyhash in code, make sure you use the keytool that comes with java 1.6 instead of java 1.7.



来源:https://stackoverflow.com/questions/14486377/android-facebook-api-exception-remote-app-id-does-not-match-stored-id

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