Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Key hash doesn't match while facebook login in android

My app uses a simple facebook login. I have entered the keyhash in my app dashboard, key_hash section and I was able to login successfully. Now I have published the app and tried to login, but it is showing a error message on a webview saying that

"Invalid android_key parameter. The key rX6qeRitkFCWui3de74rxB_qc1s does not match any allowed key. Configure your app key hashes at http://developers.facebook.com/apps/<my_fb_app_id>". 

Actually rX6qeRitkFCWui3de74rxB_qc1s is not my key hash which i have in native app. Where is it coming from? Anyways I entered this keyhash also in native app but getting the same error message and couldn't login still. Where am'i going wrong? Please help me.

like image 606
Santhosh Avatar asked May 27 '13 06:05

Santhosh


People also ask

How do I configure APP key hashes on Facebook?

Steps : Go to facebook developer's page : https://developers.facebook.com/ Open the App tabs and than click the Setting. Paste the generate hashkey on HashKey's field = If you don't have it yet, get your key hash part of code.

What is Android key hash?

You will have to enter a password. The password is: android. A code will come up and that code is your key hash.


1 Answers

You can generate a hash key through coding, you simply do one thing. Paste this code in main class (first class) then run the app and check the logcat where you will find the hash key.

One more thing, replace this package name "com.example.creeper" with your package name:

try{
        PackageInfo info = getPackageManager().getPackageInfo(
                "com.example.creeper", 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 (NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

}
like image 170
Rishi Gautam Avatar answered Sep 22 '22 03:09

Rishi Gautam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!