Ionic Facebook Api invalid key hash - android

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

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.

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

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.

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

Related

Appcelerator Android keyhash for facebook?

i am using appcelerator Studio 6.0.4GA SDK , i am having issue by finding debug.keystore
when i write in Terminal :
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
its return keyhash , i've put this keyhash in Facebook developer app but its still giving error key hash not matched , where i can get this keyhash, since i am using Mac and Appcelerator Studio .
There are 2 types of key-hashes developers need to put into FB app settings.
- Development Key Hash -
As mentioned in FB docs here, you need to run this command for all development builds,
keytool -exportcert -alias androiddebugkey -keystore debug.keystore | openssl sha1 -binary | openssl base64
androiddebugkey is the key_alias name
debug.keystore is the keystore file name which is stored in your mac user home-directory in a hidden folder .android
after running this command, it will ask for a password, put android, it's the default password for this default keystore.
- Production Key Hash -
Same command is used to get production key-hash but with your own keystore file, alias_name & password.
keytool -exportcert -alias <alias_name> -keystore <keystore_file_path> | openssl sha1 -binary | openssl base64
put alias_name as same as you used to create your production keystore.
put same password you used to generate your production keystore.
To save the work, you can simply use zON/CPoDnIgHvMure4hh9HWdR58= which represents the default dev-keystore for Titanium Android apps.
Here is the solution might help someone else
1- navigate to /Users/YOUR_USER_NAME/Library/Application Support/Titanium/mobilesdk/osx/<YOUR_SDK_VERSION>
2- type in terminal
keytool -exportcert -alias tidev -keystore dev_keystore | openssl sha1 -binary | openssl base64
3- put the password : tirocks
they keyhash will print out

How to generate a Facebook Release Key Hash on Mac?

I am trying to generate a release key hash for my Android app, following the Facebook docs, I have no problem creating the debug with:
keytool -exportcert -alias plicprintdebugkey -keystore
~/.android/debug.keystore | openssl sha1 -binary | openssl base64
It is asking for a password, I enter "android" and got the debug key.
But for the release key when I enter:
keytool -exportcert -alias plicpreleasekeyfb -keystore
/Users/vedtam/Desktop | openssl sha1 -binary | openssl base64
the terminal window spits a key, but it does not prompt for a password, and does not write anything on my desktop. I was reading this indicates an error, and the given key will be invalid.
Can someone explain how to generate the Facebook release key correctly on mac please? Thanks!
== UPDATE ==
Thanks to Mattia, I have figured out, and while there is almost 0 example out there regarding the generation of a Facebook Key Hash I hope this will guide others:
you need not only the alias to have the name of the production key, but it must be written out after the RELEASE_KEY_PATH:
keytool -exportcert -alias plicprint -keystore
/Users/vedtam/Desktop/plicprint | openssl sha1 -binary | openssl base64
You are using /Users/vedtam/Desktop as value for the options keystore. It's not correct, you should also specify also the file name, for example:
/Users/vedtam/Desktop/production.keystore
Once you find the path of your production keystore modify the command like this:
keytool -exportcert -alias RELEASE_KEY_ALIAS -keystore
/Users/vedtam/Desktop/production.keystore | openssl sha1 -binary | openssl base64

Android Facebook error:invalid key hash. the key hash does not match any stored key hashes

I signed a new version for my app today.
I added facebook login to it.
When I tried it before uploading it to google play it showed me:
invalid key hash. the key hash does not match any stored key hashes
I'm using this command to create the hash to enter to facebook:
keytool -exportcert -alias XXXX-keystore "XXXX" | "C:\Dev\openssl-0.9.8k_X64\bin\openssl.exe" sha1 -binary | "C:\Dev\openssl-0.9.8k_X64\bin\openssl.exe" base64
I checked that I use the same keystore and key that I use when I sign the app.
It worked for me with the development but not the production.
Do you have any idea?
I can't change the key for the app.
May be it couldbe late to answer, I just searched 3 days ago to find solution for this.
Please use CORRECT your alias and the password of your alias when create it.
In my case password default "android" still work even you had create another password for keystore : "123456" (this is working) , 2 passwords will have 2 different key hash, and only one working.
Use one of this versions: openssl-0.9.8e _X64.zip
You should not use the openssl-0.9.8k_X64.zip.
difference is k and e
and generate key again usingkeytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64 on cmd
Step 1. run this command in terminal:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
Step 2. Enter password: "android"
See also:
https://developers.facebook.com/docs/facebook-login/android/advanced

still Invalid Api-key cause facebook login error?

I created facebook application and i put key in key hash
still facebook login failed
error is Invalid key error.
Plz help me.
my application is ready but this problem cause delay in publishing my application.
the steps that i followed to get key hash are
copied all file from OpenSSl into jdk
set path to C:/programfiles/java/jdk/bin in command prompt
then run= keytool -export -alias androiddebugkey -keystore "[PATH]\debug.keystore" -storepass android -keypass android | openssl sha1 -binary | openssl enc -a -e
got hash key +ZRWQIs5LsdDsBNdoJ8wT2RyYrE=
copied into native android app in hash key but still error occurred plz help me
Use the below command to generate your keyhash.
keytool -exportcert -alias androiddebugkey -keystore [your path]/.android/debug.keystore | openssl sha1 -binary | openssl base64
use "android" as a password.
For more information on facebook Single Sign-On you can check the link

Problem with generating key - Android

I'm trying to get the key hesh from my app for integration with Facebook.
I've followed the Signing your Application guide on the Android Developers(http://developer.android.com/guide/publishing/app-signing.html#setup), and the Android Facebook guide(http://developers.facebook.com/docs/guides/mobile/#android).
My problem is that I don't know how to properly get the key hesh from the keystore.
Here's what I do in the cmd -
keytool -exportcert -alias androiddebugkey -keystore C:\Users\Mickael.android\debug.keystore
Then it asks for a password, and then shows me a very long gibberish key.
Now I know that key is encrypted. The facebook guide offers 2 commands -
| openssl sha1 -binary
| openssl base64
But I don't know how to get them to work.
Here is a picture of the problem -
http://img543.imageshack.us/i/keyfail.jpg/
I could really use some help
Thanks in advanced!
The output you are showing isn't going through the base64 encoder. Make sure you do the entire line below in a single line. The post makes it look like new lines, but they all need to be run as a single command.
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore
| openssl sha1 -binary
| openssl base64
See:
Key hash for Facebook Android SDK

Categories

Resources