Facebook Android Generate Key Hash

后端 未结 21 2031
误落风尘
误落风尘 2020-11-22 04:11

Trying to create an android app with Facebook integration, I\'ve gotten to the part in the docs where you have to generate a key hash file, it specifies to run the following

相关标签:
21条回答
  • 2020-11-22 05:02

    Great blog post on the subject

    Extracting the Key Hash from .p12 key

    1. Open Terminal or Command line and navigate to where your .p12 key is.
    2. Type in: “keytool -v -list -keystore mycert.p12 -storetype pkcs12″ where mycert.p12 is the filename of your .p12 key.
    3. Enter keystore password (the one you used when exported .p12 key). 4 . Copy sha1 fingerprint signature bytes text.
    4. The bytes at sha1 fingerprint signature are needed to write the “sha1.bin” file. You can use a hexadecimal editor to paste the bytes you copied. Afterwards, save the file as “sha1.bin”.
    5. Open terminal again and type in: “openssl base64 -in sha1.bin -out base64.txt”.
    6. The resulting “base64.txt” will contain the Key Hash that is needed for Facebook.

    Great and simple hexadecimal editor for mac: HexFiend

    OpenSSL should be preinstalled on mac, and here is the link for Windows version.

    Link

    0 讨论(0)
  • 2020-11-22 05:04

    SIMPLEST SOLUTION OUT THERE FOR THIS PROBLEM:

    I have had this Problem for two months now. My key hashes have been pyling up to 9. Today i finally found the simple solution:

    STEP 1:

    Install the facebook sdk you downloaded from the facebook developer page on your phone. Don´t install the normal facebook app. Make sure you can log into facebook. Then log out.

    STEP 2:

    Export your app with your final release key as an apk, like you would when uploading it to the playstore.

    STEP 3:

    Put the Apk file on your phone via usb cable or usb stick.

    STEP 4:

    Install your app, using a file manager: Example

    STEP 5:

    Launch your app and try to log in with facebook. A dialog will open and tell you: "the key YOURHASHKEY has not been found in the facebook developer console"

    STEP 6:

    Write down the key.

    STEP 7:

    Put it into your facebook developer console and save. Now you are done. Anyone that downloads your app, published with earlier used keystore can log into facebook.

    Enjoy

    0 讨论(0)
  • 2020-11-22 05:04

    The password of the debug certificate is android and not Android

    0 讨论(0)
  • 2020-11-22 05:05

    In order to generate release key hash you need to follow some easy steps.

    1) Download Openssl

    2) Make a openssl folder in C drive

    3) Extract Zip files into this openssl folder created in C Drive.

    4) Copy the File debug.keystore from .android folder in my case (C:\Users\SYSTEM.android) and paste into JDK bin Folder in my case (C:\Program Files\Java\jdk1.6.0_05\bin)

    5) Open command prompt and give the path of JDK Bin folder in my case (C:\Program Files\Java\jdk1.7.0_40\bin).

    6) Copy the following code and hit enter

    keytool -exportcert -alias abcd-keystore D:\Projects\MyAppFolder\keystore.txt | C:\openssl\bin\openssl sha1 - binary | C:\openssl\bin\openssl base64 ex - keytool -exportcert -alias (your sing apk alias name enter here like my sign apk alian name is abcd )-keystore "signed apk generated keystore apth enter here" | "openssl bin folder path enter here" sha1 - binary | "openssl bin folder path enter here" base64

    7) Now you need to enter password, Password = (enter your sign keystore password here)

    8) you got keystore which are used for release app key hash

    0 讨论(0)
  • 2020-11-22 05:06

    I was able to do perform the requested task with some of the solutions here, but thought to myself, boy that is stupid... why not to write a small Java code that does this and pack it into a Jar, so I did...

    A link to download the Jar

    Works on Windows 8... didn't try any other OS.

    0 讨论(0)
  • 2020-11-22 05:09

    Try passing the password for the key and store as part of the command

    keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -keypass android -storepass android \
    | openssl sha1 -binary \
    | openssl base64
    
    0 讨论(0)
提交回复
热议问题