9

I have created a app on facebook. I have added keyhash properly and app was running fine but when i came today and try to run it again it gives me this error. enter image description here

This is second time it happens. Previsouly when i get this error i removed the app and add it again and it starts working again and offcourse i can't do it again and again.

One more thing, the key hash he mentioned in the error is not the same i added in the app and if i go to app setting the key hash is correct there.

umerk44
  • 2,797
  • 4
  • 23
  • 43
  • 1
    _ZerO_, this isn't really a coding problem. @umerk44: Try the solution **before** the update in my answer in this question: http://stackoverflow.com/q/14875027/450534. If that doesn't work, try SOLUTION 1 in the UPDATE. Both solutions need to be used with your **Release Key**. Not the default debug key. I am assuming your app is deployed on Google Play. If not, use your default debug key. – Siddharth Lele Jun 20 '14 at 07:09

9 Answers9

7

There is no need to delete app from Facebook developer website again and again. What all you need is to go your terminal(Mac or Linux) and type:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

And Window's user open cmd and type:

keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl
base64

After this you will be asked for "Enter keystore password:", for this remember enter only android .Now use this key hash at Facebook developer website(Note: this key hash will be same as key hash you were getting in error). Mostly people are asking to delete app from Facebook developer website and again make new one,but believe me this is actually what you have to do.

Rishabh Chandel
  • 725
  • 1
  • 11
  • 28
  • so you mean that this only occurs for debugging? i have had both keys added debug and release keys in my facebook settings but although i got this message – Emil Nov 12 '17 at 17:19
  • I faced this issue for debugging only. Are you sure the key which you got from the above command is same as the one you put in facebook settings. And key should also match with the key you are getting in error.@batmaci – Rishabh Chandel Nov 13 '17 at 18:30
5

Use one of this versions: openssl-0.9.8e _X64.zip

You should not use the openssl-0.9.8k_X64.zip.

difference is k and e

and generate key again using keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64 on cmd

Keyul
  • 729
  • 1
  • 8
  • 20
4

delete the app and try to create a new hash key by following this method!

Community
  • 1
  • 1
Sreejith SP
  • 171
  • 3
  • 22
2

Add the code below to the onCreate() : *Don't forget to change the package name.

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

}

Source: https://developers.facebook.com/docs/android/getting-started/

Alexey
  • 4,384
  • 1
  • 26
  • 34
1

You have to do following step again:-

  1. Delete application on the website of Facebook (developers.facebook.com)
  2. Delete the file debug.keystore.
  3. Generate a new key (by running your app again)
  4. Create a new app on developers.facebook.com and add the new hash key
  5. Re-run your app
  6. Succes!

and more info see below link:-

https://developers.facebook.com/docs/android/getting-started/

duggu
  • 37,851
  • 12
  • 116
  • 113
  • 2
    i have tried this method once it works for me. but do i have to do it again and again. I means this is not a solution. – umerk44 Jun 20 '14 at 07:10
  • @umerk44 it means u have doing something wrong while creating hashkey so make it properly. Good luck – duggu Jun 20 '14 at 07:11
0

Only one reason of this error which Hash key different for every development environment its mean that if you are working on different machines every PC/Mac will generate its own Hash Key.

NOW SOLUTION:

IN two Simple step you can fix this error just write hash key in your Facebook Developer account like attached images:

First Step: you will see here HASH KEY note hat key and then follow next step enter image description here

Last Step: write down copied hash key in Key Hashes field. like enter image description here

No need to delete or reconfigure app.

Thanks.

M.I.
  • 21
  • 2
0

Hi In my case it was the issue with generating the release key for the production. Releasing the apk to play store requires you to generate the release key. Visit this link by Facebook for detailed information.

Vasanth
  • 560
  • 1
  • 5
  • 25
0

In my case, I had changed the package name AFTER creating the private key, so, key hash was wrong/invalid.

Karanveer Singh
  • 961
  • 12
  • 27
0

after searching two hours i have found some fundamental expects. all the doc you have followed and still key issues found then -------->> you must try with simple in react native by trying -------->> LoginManager.loginWithPermission(["public_profile"]). than(d => console.log(d)) -------->> if it show error that key does not match or invalid key hash some thing like this then please try with keytool -exportcert -alias androiddebugkey -keystore android/app/debug.keystore | openssl sha1 -binary | openssl base64 instead of facebook provided path like ~/.andorid/debug.keystore ..