Key hash not generated

I tried to get the hash key from my android application. Facebook SDK 3.0 provided the following code:

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

When I run this, it first says binary:no error ; Then it asks for the password that I entered as android . When I press enter, it returns an empty place where I expect the pass code.

I used the solution mentioned here ; this gave me a key hash, but when I use it, none of the sessions open.

My java keytool is stored in:

 C:\Program Files\Java\jre7\bin 

And OpenSSL is stored in:

 F:\openssl\bin 

I give the correct file paths when I run it in MD on Windows.

Please help me figure this out!

+4
source share
2 answers

You may have the wrong password.

Take a look at my answer here .

Hope that helps

0
source

Windows is always a little hairy and complicated to get keytool, I offer an alternative. Run the following code in the onCreate method of your application:

  try { PackageInfo info = getPackageManager().getPackageInfo( "COM.YOUR.PACKAGE.NAME", PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); Log.d("My Keyhash", Base64.encodeToString(md.digest(), Base64.DEFAULT)); } } catch (Exception e) { Log.e("My Keyhash", e.toString()); } 

and watch log output in logcat to get your keyhash. Be sure to replace the package name above.

EDIT:

the key hash is loaded correctly, but the session still does not open ... when logging into facebook, it first asks for my permission, and the application receives the message "com.facebook.facebookexception: Session Provided for the request in an unopened state"

Make sure you have this code in the "Snippet / Activity" section:

 @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data); } 
0
source

All Articles