Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 977
siddharth Avatar asked Apr 25 '26 09:04

siddharth


1 Answers

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

enter image description here

But i also stack with problem of hashkeys.

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

  • Development Key
  • Release Key

enter image description here

I think Facebook missed this option in settings.

How you can specify keys?

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

enter image description here

2) Select Android

enter image description here

3) Scroll to bottom and click Next

enter image description here

4) Change keys for development\release version.

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

like image 69
Sergey Shustikov Avatar answered Apr 27 '26 22:04

Sergey Shustikov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!