问题
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
回答1:
- 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.
回答2:
He had the same problem. My solution:
On ubuntu:
keytool -exportcert -alias androiddebugkey -keystore /home/"username"/.android/debug.keystore | openssl sha1 -binary | openssl base64
(replaces your "username")
Now you need to enter password, Password = android
I hope that helps.
回答3:
Following steps solved my problem
Go to facebook account inside settings > Apps and Websites > Logged in with Facebook > Active > click on ur app > And Remove App
After doing that try to login now and this time you will get facebook error code 1349195 : something like go to facebook docs/android page and do the setting
Now run the command from yours teminal
keytool -list -printcert -jarfile yourapkname.apk
Copy the SHA1 value and convert that into base64 and paste that base64 value into you facebook account and then try login.
To convert sha1 to base64, you can use http://tomeko.net/online_tools/hex_to_base64.php
回答4:
First check that the length is good for the key hash. Second check that you don't have letters like O and 0, l and I, they look the same (one is thicker than the other).
来源:https://stackoverflow.com/questions/33905610/ionic-facebook-api-invalid-key-hash