Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android invalid key and Facebook Connect

People also ask

How to get key hash for Facebook Login Android?

Go to the Facebook Developer site. Log into Facebook and, using the dropdown menu in the top-right, go to Developer Settings: In your developer settings, select Sample App from the menu, and add and save your key hash into your profile: You can add multiple key hashes if you develop with multiple machines.

How do I change the key hash on Facebook?

The thing that helped me is go to your FB page - Settings - Apps - Remove the app from the list. Change hash key and reinstall fb app and your app. And now it works...


Your key is: "8Ioc4p/jMXoU9Lezug4nzmZfFUg"

Now copy this key and open this URL, and paste this key in the native Android app, marked with a green border.

Enter image description here


I dont know if your problem is resolved right now but I was having the same problem as you and now I find the complete solution.

You have two enviroments for the development: debug and a signed application, when you use this commands to get your key

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64 you are getting the key for the debug.keystore,

But when you sign the app you get a new key because your app is using a new keystore.You can get your "sign app key" using this program. http://www.easyfacebookandroidsdk.com/download/keyhash.zip but you have to sign with the same keystore that you are using in your app.


Your key is

8Ioc4p/jMXoU9Lezug4nzmZfFUg

This key is encrypted by your device so you have we have to let this key be known to Facebook user (in your application which you create in Facebook).

Now you have to copy this key in the native app and then save it. After some minutes, you can get all access..


The error for me was caused by the mismatch between my debugging key when I was testing my app and the release key when I was signing a release version.

11-02 16:41:31.660: D/Facebook-authorize(13194): Login failed: invalid_key:Android key mismatch. Your key "8Ioc4p/jMXoU9Lezug4nzmZfFUg" does not match the allowed keys specified in your application settings. Check your application settings at http://www.facebook.com/developers

If you copy and paste 8Ioc4p/jMXoU9Lezug4nzmZfFUg to the Android Key Hash field in the Facebook application settings it should work. If you get this error again (showing a different key value) when you test your signed release version, copy that additional key into the Hash Field after the original entry, so you have two values in there.

I was surprised that more than one entry was allowed in the Key Hash Field, but it appears it is ok and it's solved the problem for me for both testing and release versions.


The debug native Android application key is generated automatically using debug.keystore file located at ~/.android/debug.keystore. When you are developing your application on multiple machines, you should have the same debug.keystore file...

Once this is done, you can paste the debug native Android application key to the Facebook settings page of your application.


You actually do not past this key directly, but a Base64 value of this key.

Refer to https://developers.facebook.com/docs/mobile/android/build/#sig which explains you how to generate this.


Please check your application page in Facebook and confirm that both keys are same. I think you won't register your app on Facebook