Android Facebook SDK: generate release key hash

后端 未结 11 1923
执念已碎
执念已碎 2020-12-04 14:49

I\'m building an app in which users can log in with Facebook.

I\'ve created the hash keys like following:

try {
         PackageInfo info = getPackag         


        
相关标签:
11条回答
  • 2020-12-04 15:05
    keytool -exportcert -alias aliasName -keystore C:\my_release_keystroke_info.jks | openssl sha1 -binary | openssl base64
    
    0 讨论(0)
  • 2020-12-04 15:09

    I find a solution. for MAC

    Use this one to get YOUR_RELEASE_KEY_ALIAS:

    keytool -list -keystore /Users/***/Documents/keystore/***.jks
    

    and this one to get your release keyhash:

    keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore /Users/***/Documents/keystore/***.jks | openssl sha1 -binary | openssl base64
    

    It works for me.

    0 讨论(0)
  • 2020-12-04 15:15

    We need to replace the word "openssl" by the path of one file inside the openssl structure.

    So, My CMD command is:

    C:\Program Files\Java\jre1.8.0_45\bin>keytool -exportcert -alias Informatheus -keystore C:\Users\Atendimento\Dropbox\AndroidKeystore\Keystore | C:\Users\Atendimento\Desktop\openssl\bin\openssl sha1 -binary | C:\Users\Atendimento\Desktop\openssl\bin\openssl base64
    

    It worked.

    0 讨论(0)
  • 2020-12-04 15:16

    The simplest way to get hash key released apk is : Get SHA1 key of released apk using following command:

    keytool -list -v -keystore keystore_path.jks -alias keystoreAlias
    

    Thn you will get SHA1 key. Copy that key and generate hash key using following site:

    Link to get hash key

    You will get Output (base64): copy it and use where you want..

    0 讨论(0)
  • 2020-12-04 15:19

    This one is the easiest way i found so far for generating key hash!

    try
    {
      PackageInfo info = getPackageManager().getPackageInfo(
          "Your Package Name",
          PackageManager.GET_SIGNATURES);
      for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.d("KeyHash:",Base64.encodeToString(md.digest(),Base64.DEFAULT));
      }
    } catch (PackageManager.NameNotFoundException e) {
    
    } catch (NoSuchAlgorithmException e) {
    
    }
    
    0 讨论(0)
提交回复
热议问题