Solution:
The error happens since of invalid hash key.
We can make Hash key emplying the below command and update the similar here under Settings-> Basic -> Android HashKeys
keytool -exportcert -alias ADD_RELEASE_KEY_ALIASE_HERE -keystore ADD_UR_KEYSTORE_PATH_HERE | openssl sha1 -binary | openssl base64
You can trace the Relase Key Alias of your keystore employing the below command if required:
keytool -list -keystore ADD_UR_KEYSTORE_PATH_HERE
I have also experience an problem like by employing the above HashKey the login performs fine in case I install the release APK directly to the device, however when I upload the APK to Play Store and install app from store then it displays the same Login failed error. The solve for this issue is as follows:
Go to Release Management
Choose Release Management
-> App Signing
You can view SHA1 key in hex format App signing certificate.
Copy the SHA1 in hex format and change it in to base64 format, you can exercise this link do that without the SHA1: part of the hex.
Go to Facebook developer console and include the key(after convert to base 64) in the settings —> basic –> key hashes.
Only throwing this out there for people still experiencing this problem. The hash I made through the keytool was somehow incorrect. I solved it by doing the following:
In case you meanwhile uploaded your app to the playstore and enabled "app signing by Google Play" there is a solution (at least this performed for me):
login into you play console
click on the app
Currently, on the left side click "release management"
click on "App signing"
Under "App signing certificate" copy the SHA-1 certificate fingerprint
Go to http://tomeko.net/online_tools/hex_to_base64.php
Paste the SHA-1 in the first field
Copy the text in input field under "Output (base64)"
Presently, open developer.facebook.com/apps
Click on your app
On the left side navigate to "Settings" -> "Basic"
Paste the Base64 text here under key hashes
UPDATE
The steps above must still fully perform.
However, in case you do not want to paste your key on that website, here is an alternative to step 6,7,8 below:
here's a oneliner Node.js command to do the same:
node -e 'console.log(Buffer.from(process.argv[1].split(":").map(hex => parseInt(hex, 16))).toString("base64"))' '5E:8F:16:06:2E:A3:CD:2C:4A:0D:54:78:76:BA:A6:F3:8C:AB:F6:25'