Skip to main content

Facebook Login on Android

This guide assumes you already created a Facebook app and enabled Facebook in Firebase Auth.

Quick Answer

Add your Android package name and debug/release key hashes to the Facebook app, update the Android Facebook App ID resource, rebuild, and test login on a real Android device.

1. Confirm Android Package Name

Open android/app/build.gradle and confirm the applicationId for the variant you ship.

This value must match:

  • Firebase Android app package name;
  • Facebook app Android package name;
  • Google Play package name;
  • release build application ID.

2. Generate Android Key Hashes

Facebook Login needs key hashes for every signing key that can build the app.

Add both:

  • debug key hash for local testing;
  • release key hash for Play Store builds.

Use Meta's Android setup documentation from your Facebook app dashboard to generate the hash for your environment and keystore.

3. Add Android Platform in Meta for Developers

  1. Open Meta for Developers.
  2. Select your app.
  3. Open Settings > Basic.
  4. Add the Android platform if it is not present.
  5. Add the package name.
  6. Add debug and release key hashes.
  7. Save changes.

4. Update Android Resources

Open:

android/app/src/main/res/values/strings.xml

Update the Facebook App ID:

<string name="facebook_app_id">your-facebook-app-id</string>

If your app includes a client token resource, update that with the value from Meta for Developers as well.

5. Rebuild Android

yarn android

For release verification:

cd android
./gradlew app:assembleGooglePlayDebug

Verification

  1. Open the login screen.
  2. Tap Facebook Login.
  3. Complete the Meta login flow.
  4. Confirm Firebase creates or links the user account.
  5. Test the same flow in the release-signed build before store submission.

Troubleshooting

ProblemFix
Invalid key hashAdd the exact debug or release key hash shown by the error to Meta app settings.
Login works in debug but not releaseAdd the release keystore hash and confirm the release applicationId.
Firebase rejects the credentialCheck Facebook provider setup in Firebase Auth and the OAuth redirect URI.
Wrong app opensCheck package name, App ID, and any old demo IDs in resources.

Next Steps