Ionic Facebook Api invalid key hash

Iqbal Khan picture Iqbal Khan · Nov 25, 2015 · Viewed 10.3k times · Source

I can't get my app to allow Facebook login. Everytime the users tries to login to Facebook and authenticate my app with their FB, it gives me this error:

Invalid key hash. They key hash xxxxxxxxxx= does not match any stored key hashes. configure your app key hashes at http://developers.facebook.com/apps/xxxxxxxx

I've already tried creating a new key hash through the OpenSSL tool like so:

keytool -exportcert -alias androiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64

Doing this gives me a key hash, which I then add into the 'Key Hashes' list on the developer page for the app. I then use ionic to rebuild the app, and when I run it on my android phone it gives the same error. There is another version of the app that was built on another computer, and a different hash key was used, and that worked perfectly, but the hash key from this computer doesn't seem to want to work. Any help would be great

Answer

janekkkk picture janekkkk · Nov 8, 2017
  • On Windows: keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64
  • On Mac: keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

The password is android.

Also see the Ionic docs for more info.