domingo, 5 de mayo de 2013

Obtener el key hash para facebook Android SDK


Firstly, to generate your key hash on your local computer, run Java's keytool utility (which should be on your console's path) against the Android debug keystore. This is, by default, in your home .android directory). On OS X, run:
 
keytool -exportcert -alias androiddebugkey 
 -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
 
On Windows, use:

NOTA
Para usar en windows, nos ubicamos en la consola CMD en la carpeta C:\Program Files\Java\jdk1.7.0_03\bin, en esta direccion exta el archivo keytool.exe, y escribimos la siguiente linea.

keytool -exportcert -alias androiddebugkey -keystore  
%HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64

Nos pide contraseña, y escribimos < android >, y listo obtenemos la clave.

You will be prompted for a password. This should be 'android' without quotes. You'll then be given a key hash of 30 characters or so. (If you are not prompted for a password, something is wrong and you must check your paths above to ensure the debug.keystore is present.)
Finally go to the Facebook Developer site. Make sure you are logged into Facebook and, using the dropdown menu in the top-right, go to your 'Settings':
Then, go to the 'Developer Settings' section on the left. If you haven't done so yet, you will be required to quickly register as a developer.
You'll then be able to add and save your key hash into your profile:


(Note that you can add multiple key hashes here if you are developing with multiple machines.)
You will now be able to compile and run all of the authentication-based samples on your emulator without issue.

3 comentarios:

  1. como puedo generar un hash key unico para todos los devs de mi oficina, para q asi todos los q generen la aplicacion tenga el acceso

    ResponderEliminar
  2. De hecho el hash que te genera lo puedes usar en todas tus Apps, al menos yo he hecho varias y de esta forma lo he probado y si me ha funcionado.

    ResponderEliminar