0

I have created the key hash using the following code:

try {
        PackageInfo info = getPackageManager().getPackageInfo("com.snada.main.view",
                                    PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.i("Key: ", Base64.encodeToString(md.digest(), 0));
        }
    } catch (NameNotFoundException e) {
        Log.e("Test", e.getMessage());
    } catch (NoSuchAlgorithmException e) {
        Log.e("Test", e.getMessage());
    }

It is generated key successfully. I have copied the key into the facebook developer site. But I am unable to login using facebook.

I am calling facebook using

loginButton.setUserInfoChangedCallback(new LoginButton.UserInfoChangedCallback() {
        @Override
        public void onUserInfoFetched(GraphUser user) {

            //////////////
            /*Session session = Session.getActiveSession();
            if (session != null){
                 session.closeAndClearTokenInformation();
                 session = null;
                 Log.i("TAG", "cleared session");
            }*/
            ///////////


            SigninView.this.user = user;
            isUiUpdateCall = true;
            updateUI();
            // It's possible that we were waiting for this.user to be populated in order to post a
            // status update.
            handlePendingAction();
        }
    });
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • try using my Facebook tool here: http://stackoverflow.com/a/17732453/2476453 – Shahar Dec 23 '13 at 11:15
  • K, so first, check that your package name is correct. then, post a log of Facebook response so we can determine the error. – Shahar Dec 23 '13 at 11:20
  • i am unable to print the log of facebook response. Can you please tell me the how do i print the facebook response in logcat. I am using facebook sdk 3.5 – user2775735 Dec 23 '13 at 11:25
  • add the call to facebook you are doing (add to main question) – Shahar Dec 23 '13 at 11:29

1 Answers1

0

I too faced the same problem. We made sure that the facebook dashboard details like package name and the hashkey are the same. It should work.

And also, unckeck the developer sandbox.

amalBit
  • 12,041
  • 6
  • 77
  • 94