简体   繁体   中英

Android facebook sdk login issue for second time

I have hash key of my signing certificate, I got using keytool as below :

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl
base64

I have successfully generated key and I have add that key to my Facebook developer page.

When i run my app for first time, then it will works fine but when i try again after logout and login again, it shows error message - this app has no android key hashes configured

i have also tried the below code:

   try {
       PackageInfo info = getPackageManager().getPackageInfo(
               "com.example.mypack", PackageManager.GET_SIGNATURES);
       for (android.content.pm.Signature signature : info.signatures) {
           MessageDigest md = MessageDigest.getInstance("SHA");
           md.update(signature.toByteArray());
           Log.i("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
           }
   } catch (NameNotFoundException e) {
   } catch (NoSuchAlgorithmException e) {
   }

But still its not working. Same problem happens with Facebook hello sample app. How can i solve this issue?

In new Facebook SDK you can configure hash-keys of your application in MyApps/YourAppName/Settings :

在此输入图像描述

But i also stack with problem of hashkeys.

When we configure application the first time, you can specify two hashkeys :

  • Development Key
  • Release Key

在此输入图像描述

I think Facebook missed this option in settings.

How you can specify keys?

1) Open Settings of your Application and click on Getting Started

在此输入图像描述

2) Select Android

在此输入图像描述

3) Scroll to bottom and click Next

在此输入图像描述

4) Change keys for development\\release version.

Note. In my case i specify same keys for both version. This is not good way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM