Search code examples
androidfacebooksdkkeymismatch

Hashkey mismatch android facebook app


Downloaded recent facebook android sdk 3.7 and i tried to run sample apps in the sdk. When I tried helloFacebookSample app i got hashkey problem. I searched through web and got my hashkey correct i.e DSygOIIJUkYyHy/duT1e72ZHl5U=.

My app is showing "hashkey not stored" error. When I logged my sample app hashkey I found strange thing happening.

I am using this code:

Toast.makeText(getApplicationContext(),Base64.encodeToString(md.digest(), Base64.DEFAULT), Toast.LENGTH_LONG).show();
                Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));

                Toast.makeText(getApplicationContext(),Base64.encodeToString(md.digest(), Base64.DEFAULT), Toast.LENGTH_LONG).show();

Same piece of code is showing different hashkeys

DSygOIIJUkYyHy/duT1e72ZHl5U=

2jmj7l5rSw0yVb/vlWAYkK/YBwk=

and when I try to post status it shows a different hashkey.

DSygOIIJUkYyHy_duT1e72ZHl5U=

I have stored all three hashkeys in my sample app, and it is still showing me this error.


Solution

  • This problem usually comes when hashkey generated by your app doesnt match with the one which you have put in facebook developers site. Try to generate the hashkey programmatically and put it in developers site. Hope this solution helps