Key hash for Android-Facebook app

后端 未结 30 2686
误落风尘
误落风尘 2020-11-22 01:17

I\'m working on an Android app, in which I want to integrate a Facebook posting feature. I downloaded the Facebook-Android SDK, and I got the readme.md (text file) in there,

相关标签:
30条回答
  • 2020-11-22 01:55
    keytool -exportcert -alias androiddebugkey -keystore       C:\Users\pravin\.android\debug.keystore | "H:\OpenSSL\bin\openssl" sha1 -binary | "H:\OpenSSL\bin\openssl" base64
    

    This worked for me ...

    Steps:

    1) Open command line go to - > java Keytool..... for me C:\Program Files\Java\JDK1.7\bin
    2) Download OpenSSL from google
    3) paste this with changing your paths -
       keytool -exportcert -alias androiddebugkey -keystore C:\Users\pravin\.android\debug.keystore | "H:\OpenSSL\bin\openssl" sha1 -binary | "H:\OpenSSL\bin\openssl" base64 
    
        ....................   give proper debug.keystore path and openSSL path .. 
    
    4) Finley it may be ask u password .. so give password -> android   ...
    5) you will get 28 characters that will be your has key
    
    0 讨论(0)
  • 2020-11-22 01:56

    To get the Android key hash code, follow these steps:

    1. Download OpenSSL for Windows here
    2. Now unzip to the C drive
    3. Open a CMD prompt
    4. Type cd C:\Program Files\Java\jdk1.6.0_26\bin
    5. Then type only keytool -export -alias myAlias -keystore C:\Users\your user name\.android\myKeyStore | C:\openssl-0.9.8k_WIN32\bin\openssl sha1 -binary | C:\openssl-0.9.8k_WIN32\bin\openssl enc -a -e
    6. Done
    0 讨论(0)
  • 2020-11-22 01:56

    To generate a hash of your release key, run the following command on Mac or Windows substituting your release key alias and the path to your keystore.

    On Windows, use:

    keytool -exportcert -alias <RELEASE_KEY_ALIAS> -keystore <RELEASE_KEY_PATH> | openssl sha1 -binary | openssl base64
    

    This command should generate a 28 characher string. Remember that COPY and PASTE this Release Key Hash into your Facebook App ID's Android settings.

    image: fbcdn-dragon-a.akamaihd.net/hphotos-ak-xpa1/t39.2178-6/851568_627654437290708_1803108402_n.png

    Refer from : https://developers.facebook.com/docs/android/getting-started#release-key-hash and http://note.taable.com

    0 讨论(0)
  • 2020-11-22 01:57

    Download openSSL -> Install it -> it would usually install in C:\OpenSSL

    then open cmd and type

    cd../../Program Files (Enter)
    
    java (Enter)
    
    dir (Enter)
    
    cd jdk1.6.0_17 (varies with jdk versions) (Enter)
    

    to check jdk version go to C:/program files/java/jdk_version

    cd bin (enter)
    
    keytool -exportcert -alias androiddebugkey -keystore C:Users\Shalini\.android\debug.keystore | "C:\OpenSSL\bin\openssl sha1 -binary | "C:\OpenSSL\bin\openssl base64 (Enter)
    

    It will ask you for password which is android.

    0 讨论(0)
  • 2020-11-22 01:59

    The simplest solution:

    1. Don't add the hash key, implement everything else
    2. When facebook login is pressed, you will get an error saying "Invalid key hash. The key hash "xxx" does not match any stored key. ..."
    3. Open the facebook app dashboard and add the hash "xxx=" ("xxx" hash from the error + "=" sign)
    0 讨论(0)
  • 2020-11-22 01:59

    Use this for print key hash in kotlin

    try {
            val info = context.getPackageManager().getPackageInfo(context.packageName,
                    PackageManager.GET_SIGNATURES);
            for (signature in info.signatures) {
                val md = MessageDigest.getInstance("SHA")
                md.update(signature.toByteArray())
                Log.d("Key hash ", android.util.Base64.encodeToString(md.digest(), android.util.Base64.DEFAULT))
            }
        }catch (e:Exception){
    
        }
    
    0 讨论(0)
提交回复
热议问题