Ionic Facebook Api invalid key hash

本秂侑毒 提交于 2019-12-23 10:09:40

问题


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

  1. Go to facebook account inside settings > Apps and Websites > Logged in with Facebook > Active > click on ur app > And Remove App

  2. 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

  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!