-5

Facebook Login is not working on my side. can Anyone Have Its solution how to login to Facebook from my app.

It is giving me Invalid Key Hash error.

Rishi Paul
  • 936
  • 2
  • 8
  • 25

3 Answers3

1

try creating android hash key programmatically. Put following code in OnCreate() method of your demo.

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

}

you will get a key in log. Copy and paste it in facebook developer console. I dont how you have generated the hash key but through command prompt i had an issue so try it out.

1

if keyHash always saying incorrect put any invalid keystore at developing time and use same account of facebook developer key account and testing account and if developer accounts working fine than put signed build in playstore and then download application form playstore and try to login with facebook than application give error of keyhash copy that keyhash form mobile and put it into facebook developer key application its working

second options open and enter genrate keyhash online

wadali
  • 1,931
  • 16
  • 36
0

There is a way mentioned on Facebook Tutorial for generating key hash using command line on windows that doesn't always work. Try this

Community
  • 1
  • 1
Mayank
  • 1,266
  • 14
  • 28