How to generate a Facebook Release Key Hash on Mac? - android

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

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

Ionic Facebook Api invalid key hash

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

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

Keytool does not ask password (using Facebook lib with android)

I run the script below like Facebook said. There is no compiling problem. The problem is it never gives me a password question after process finished and according to facebook documentation it means my keystore path is incorrect. But debug.keystore file is in correct path! C:\Users\KSM45.android
Please let me know where do I make mistake? I just want to login with facebook!
(From documentation page: Also make sure you are using the correct password - for the debug keystore, use 'android' to generate the keyhash. General Rule: If the tool does not ask for password, your keystore path is incorrect.)
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
Try to delete your keystore in ~/.android/debug.keystore then clean your project in eclipse and run your app so the eclipse plugin re-create your keystore.
I tried it on WinXP at work today and it didn't work. After few trying I realized this
this is the line i ran and failed:
keytool -exportcert -alias androiddebugkey -keystore C:\Documents and Settings\Administrator.android\debug.keystore | openssl sha1 -binary | openssl base64
the thing is, you should put "quotation marks" around your debug.keystore path
just like this:
keytool -exportcert -alias androiddebugkey -keystore "C:\Documents and Settings\Administrator.android\debug.keystore" | openssl sha1 -binary | openssl base64

Hash Key Facebook API. Android for release mode not debug. MAC OS

Well.. first of all, sorry for my english..
The api facebook works perfectly in the emulator but when i put it on a mobile it doesnt work.. just open and close the window.. so..
I found this 2 commands to generate the Hash Key but i dont know witch one is the correct or what im doing wrong, because i write any password and the command works but at the mobile not..
This is for debug mode.. and the password is default "android"
keytool -exportcert -alias androiddebugkey -keystore /Users/user/.android/debug.keystore | openssl sha1 -binary | openssl enc -a -e
This is for release mode.. and the password is the password of your signing key..
keytool -exportcert -alias androiddebugkey -keystore /Users/user/Desktop/testsing | openssl sha1 -binary | openssl enc -a -e
What I am doing wrong?
Thank you!!
You can try this way to bu sure 100%
Go to Your folder on command prompt with Java\bin like example: C:\Program Files\Java\jdk1.7.0_09\bin>
Prepare your commands
from facebook developer tutorial:
keytool -exportcert -alias androiddebugkey -keystore
%HOMEPATH%.android\debug.keystore | openssl sha1 -binary | openssl
base64
if you have any problem with openssl you can download it and install example on C:\OpenSSL and then
keytool -exportcert -alias androiddebugkey -keystore
%HOMEPATH%.android\debug.keystore | "C:\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64

Categories

Resources