SHA-1 & SHA-256 Keys
Firebase needs the fingerprints of your Android signing keys for Google sign-in and phone (OTP) sign-in.
A SHA key is the fingerprint of the key that signs your Android app. Firebase needs it for:
| Sign-in | Needs |
|---|---|
| Continue with Google | SHA-1 |
| Phone number (SMS code) | SHA-1 and SHA-256 |
All three Go4Food apps (customer, restaurant and driver) offer Google and phone sign-in, so add the keys to all three Android apps in Firebase.
Three different keys
| Key | Signs |
|---|---|
| Debug key | flutter run on your computer. Each computer has its own. |
| Upload key (your JKS) | APKs and AABs you build with your own keystore (Android release) |
| Google Play app signing key | The app people install from Google Play. Google re-signs your AAB. |
1. Get the fingerprints#
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Use the file name and alias you chose when you created the keystore:
keytool -list -v -keystore your-keystore.jks -alias your-alias
Play Console → your app → Test and release → App integrity → App signing. Copy the SHA-1 and SHA-256 of the App signing key certificate. It appears after your first AAB upload.
Copy the lines that start with SHA1: and SHA256:.
Or let Gradle list them
From the app's android folder run ./gradlew signingReport (gradlew signingReport on Windows). keytool comes with Java; Android Studio has its own copy in its jbr/bin folder.
2. Add them in Firebase#
Open your Android app#
Firebase console → gear icon → Project settings → General → under Your apps, pick the Android app, for example com.yourbrand.customer.
Add each fingerprint#
Click Add fingerprint, paste a SHA-1, Save. Again for the SHA-256. Repeat for every key above, then for the restaurant and driver apps.
Refresh the settings file#
Run flutterfire configure in the app folder again (Connect with FlutterFire), or download google-services.json and replace android/app/google-services.json. Then rebuild.
Changed the keystore?
A new keystore means new fingerprints. Add them to Firebase again, or Google and phone sign-in stop working.