0

I developed an app that uses the Facebook Login to login. I am using the default login button that is provided in Facebook SDK 3.7 for login functionality. The issue is, some devices are unable to login into the app. The issue is occurring on a few devices, more than 70% devices are able to login.

The error is:

Session state:CLOSED_LOGIN_FAILED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[]}
sandeep
  • 481
  • 1
  • 6
  • 14

1 Answers1

0

Seems like a hash generation issue.

Just use this solution -

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("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
    }

This uses the standard hash generation provided by facebook.

The same is also mentioned here.

UPDATE:

Although the problem is generally related to the way you are generating the hash and the method where you have placed the facebook login code, I think that there are some good tutorials out there from which you can confirm your outcome. One such is mentioned below.

If you want to check the step by step way of login in to facebook then read the following tutorial using-facebook-sdk-android-development-part-1.

Community
  • 1
  • 1
sjain
  • 23,126
  • 28
  • 107
  • 185
  • Hi ved Prakash, I am using same thing in my app.Almost 60 % of devices are logging good but in some devices it is not logging.iam getting the above mentioned error. – sandeep Apr 15 '14 at 11:26
  • From which activity life cycle method are you calling this login code ? Try to call it `oncreate()` of your activity. – sjain Apr 15 '14 at 11:37
  • I am calling from onCreate(). – sandeep Apr 17 '14 at 07:23