How to Provide Key Hashes for Your Android App to Facebook Developer Platform : Flutter

Mobterest Studio
4 min readAug 9, 2023

--

Facebook login: Key Hashes for Your Android App

If you’re integrating Facebook Login or other Facebook-related features into your mobile app, you’ll need to provide key hashes to Facebook Developers.

These key hashes are used to ensure the security of your app’s communication with Facebook’s servers.

This guide is a follow up to the User Authentication Tutorial over on Youtube.

User Authentication Tutorial

In this guide, I’ll walk you through the process of generating and providing the key hash for your Android app.

Understanding Key Hashes

Key hashes are cryptographic signatures of your app’s signing certificate. They serve as a security measure to validate that the app communicating with Facebook is indeed the one you’ve registered.

Generating SHA1 Fingerprint

  1. Open your terminal or command prompt.
  2. Navigate to your app’s Android project directory.
cd android

3. Next let’s generate the SHA1 fingerprint certificate. There are 3 ways to do this:

a) Using Play App Signing

b) Keytool or

c) Gradle’s signing report.

Run the following command to generate the development key hash using the Gradle signingReport.

./gradlew signingReport

This will print out a report for 3 variants of Task:app:signingReport : debug, release and profile referring to the 3 types of build modes in Flutter. Pick from your preferred mode.

> Task :app:signingReport
Variant: XXXXXXX
Config: XXXXXXX
Store: XXXXXXX
Alias: XXXXXXX
MD5: XXXXXXX
SHA1: XXXXXXX
SHA-256: XXXXXXX
Valid until: XXXXXX

Generate Key Hash using SHA1

To do this:

  1. Navigate to tomeko.net
tomeko.net

2. Enter the SHA1 fingerprint on Hex string Textfield

Enter SHA1 fingerprint

3. Click Convert.

4. You’ll get the key hash in the Output textfield.

Providing Key Hash to Facebook Developer Platform

  1. Open your web browser and go to the Facebook Developers website.
  2. Log in with your developer account and navigate to your app’s dashboard.
  3. In the left sidebar, click on “Settings” under the “Basic” section.
Facebook Developer Platform: Add Android Platform

4. Scroll down. If you do not have an “Android” section, click on Add platform.

Facebook Developer Platform: Add Android Platform

5. Select “Android” platform and click on “Next”

Facebook Developer Platform: Add Android Platform

6. Select “Android Store” or skip by clicking on “Next

Facebook Developer Platform: Add Android Platform

7. The Android section will be displayed and there will be a Textfield to insert the “Key Hash”

Facebook Developer Platform: Add Android Platform

8. Copy and paste the key hash we generated.

Facebook Developer Platform: Add Android Platform

9. Click Save changes.

Conclusion

Providing key hashes for your Android app to Facebook Developer Platform is a crucial step to ensure the security and functionality of Facebook-related features within your app. By following the steps outlined in this guide, you can seamlessly integrate Facebook features while maintaining the integrity of your app’s communication with Facebook’s servers.

Remember to keep your key hashes safe and avoid sharing them in publicly accessible locations. Properly securing your key hashes is an essential aspect of protecting your app and its users.

👏🏽 👏🏽 Give this story CLAPS

👉🏽 Subscribe for upcoming articles

💰 Access Free Mobile Development tutorials

🔔 Follow for more

See you on next article 👋

--

--