Facebook login error Kotlin — Android

Sudhanshu Srivastava
1 min readApr 4, 2023

If you are facing error in facebook login and getting error message saying

“This app has no Android key hashes configured. Configure your app key hashes at https://developers.facebook.com/apps/YOUR_FB_APP_ID”

This app has no Android key hashes configured. Configure your app key hashes at https://developers.facebook.com

Then this is what you need to do.

You need to create a Key hash and add it here

How to generate Key hash

You can add this function and add to your Activity.kt file and call it like this.

This is temporary function just to get the hash key which you should remove once you get the “KeyHash: YOUR_HASH_KEY”

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
generateFBHashKey()
}
private fun generateFBHashKey() {
try {
val info: PackageInfo = packageManager.getPackageInfo(
"com.bundle.id",
PackageManager.GET_SIGNATURES)
for (signature in info.signatures) {
val md = MessageDigest.getInstance("SHA")
md.update(signature.toByteArray())
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT))
}
} catch (e: PackageManager.NameNotFoundException) {
} catch (e: NoSuchAlgorithmException) {
}
}

Note: You’ll have to create Key hashes for all the build variants you have.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Sudhanshu Srivastava
Sudhanshu Srivastava

Written by Sudhanshu Srivastava

I write about what I learn. Swift, Kotlin, Flutter, Social and Life.

No responses yet

Write a response

Recommended from Medium

Lists

See more recommendations