Key hash for Facebook Android SDK

前端 未结 9 1927
后悔当初
后悔当初 2020-11-28 03:29

I can\'t figure out how to get the Key Hash required to use the Facebook Android SDK. I figured out that I can use keytool with these commands:

         


        
9条回答
  •  一生所求
    2020-11-28 04:24

    I created a batch script facebookkeydebug.bat, which return desired Facebook key hash. Just edit the script, set correct paths, keystore name and run it.

    :: Getting Android key hash for Facebook app on Windows
    :: Requirement: OpenSSL for Windows (http://code.google.com/p/openssl-for-windows/downloads/list)
    :: Usage: set paths and run facebookkeydebug.bat
    
    @echo Exporting keystore cert
    keytool -exportcert -alias androiddebugkey -keystore C:\Users\myusername\.android\debug.keystore -storepass android -keypass android > debug.keystore.bin
    
    @echo Converting to sha1
    C:\PROGRAMS\openssl-0.9.8k_X64\bin\openssl sha1 -binary debug.keystore.bin > debug.keystore.sha1
    
    @echo Converting to base64
    C:\PROGRAMS\openssl-0.9.8k_X64\bin\openssl base64 -in debug.keystore.sha1 -out debug.keystore.base64
    
    @echo Done, Android hash key for Facebook app is:
    C:\PROGRAMS\openssl-0.9.8k_X64\bin\openssl base64 -in debug.keystore.sha1
    @pause
    

    EDIT: I published a repo with some batch scripts for signing and getting cert keys on Windows: https://github.com/petrnohejl/Android-Scripts

提交回复
热议问题