1

When I build a generate a signed APK and install it on my Android device authentication works as expected, however when I generate a signed app bundle and deploy to playstore then install through the test channel the authentication stops working.

For google it will show the account picker but after selecting an account the picker dissapears and nothing happens (no error logged in logcat).

When using Apple nothing happens at all and I get an error in logcat: "INVALID_CERT_HASH 400".

I've doulbe/triple checked my cert hashes against the signing key and I'm sure I've set the correct ones. Have added both the debug and release sha1 and sha256 to the firebase console, downloaded the google-services.json and used that when running.

It works fine if I build a signed release apk and manually install it on the phone or I run it via android studio - but it doesn't work when going through the playstore.

This is the full output when choosing to sign in with apple:

2022-08-16 00:36:06.428 1973-1973/? W/adbd: timeout expired while flushing socket, closing
2022-08-16 00:36:06.743 2790-3875/? I/HbmSvManager:  Request state 2 req 0
2022-08-16 00:36:07.035 1186-1569/? V/DisplayPowerController[0]: Brightness [0.06408318] reason changing to: 'automatic', previous reason: 'automatic [ dim ]'.
2022-08-16 00:36:07.049 504-504/? I/display: level=88, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.065 504-504/? I/display: level=96, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.081 504-504/? I/display: level=103, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.083 1071-1071/? D/AOC: A3:MSG: tmd3719_sensor.cc, 281: USF: TMD3719: brightness:103 refresh_rate:60 status:1
2022-08-16 00:36:07.099 504-504/? I/display: level=111, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.115 504-504/? I/display: level=119, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.132 504-504/? I/display: level=128, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.149 504-504/? I/display: level=137, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.163 1186-2628/? I/ActivityTaskManager: START u0 {act=com.google.firebase.auth.internal.NONGMSCORE_SIGN_IN pkg=redacated.myapp.com cmp=redacated.myapp.com/com.google.firebase.auth.internal.GenericIdpActivity (has extras)} from uid 10250
2022-08-16 00:36:07.170 504-504/? I/display: level=146, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.172 1186-2628/? W/ActivityTaskManager: Tried to set launchTime (0) < mLastActivityLaunchTime (15219249)
2022-08-16 00:36:07.180 12284-12896/? W/System: Ignoring header X-Firebase-Locale because its value was null.
2022-08-16 00:36:07.184 504-504/? I/display: level=155, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.190 504-504/? I/display: level=159, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.198 1186-1543/? I/ActivityTaskManager: Displayed redacated.myapp.com/com.google.firebase.auth.internal.GenericIdpActivity: +35ms
2022-08-16 00:36:07.199 504-504/? I/display: level=165, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.217 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3273 
2022-08-16 00:36:07.218 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2165 repeatCheckTimes = 0, unlocked = true
2022-08-16 00:36:07.218 504-504/? I/display: level=175, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.218 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.onStartInput():1956 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=redacated.myapp.com fieldId=-1 fieldName=null extras=null}, false)
2022-08-16 00:36:07.218 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.shouldHideHeaderOnInitialState():4081 ShouldHideHeaderOnInitialState = false
2022-08-16 00:36:07.218 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2165 repeatCheckTimes = 2, unlocked = true
2022-08-16 00:36:07.233 504-504/? I/display: level=185, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.248 504-504/? I/display: level=196, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.271 504-504/? I/display: level=211, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.273 1071-1071/? D/AOC: A3:MSG: tmd3719_sensor.cc, 281: USF: TMD3719: brightness:211 refresh_rate:60 status:1
2022-08-16 00:36:07.289 504-504/? I/display: level=215, DimmingOn=1, HbmMode=0, LhbmOn=0
2022-08-16 00:36:07.578 12284-12896/? E/FirebaseAuth: [GetAuthDomainTask] Error getting project config. Failed with INVALID_CERT_HASH 400
2022-08-16 00:36:07.660 1186-1617/? W/InputManager-JNI: Input channel object '24df3cb redacated.myapp.com/com.google.firebase.auth.internal.GenericIdpActivity (client)' was disposed without first being removed with the input manager!
2022-08-16 00:36:07.666 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3273 
2022-08-16 00:36:07.667 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2165 repeatCheckTimes = 0, unlocked = true
2022-08-16 00:36:07.667 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.onStartInput():1956 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x12000000 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=redacated.myapp.com fieldId=2131231160 fieldName=null extras=null}, false)
2022-08-16 00:36:07.667 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.shouldHideHeaderOnInitialState():4081 ShouldHideHeaderOnInitialState = false
2022-08-16 00:36:07.667 1851-1851/? I/GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2165 repeatCheckTimes = 2, unlocked = true
2022-08-16 00:36:07.890 2790-3875/? I/HbmSvManager:  Request state 2 req 0
2022-08-16 00:36:07.919 2790-3875/? I/HbmSvManager:  Request state 2 req 0
meds
  • 21,699
  • 37
  • 163
  • 314
  • Does this answer your question? [Firebase Authentication - Phone - "INVALID\_CERT\_HASH"](https://stackoverflow.com/questions/65040615/firebase-authentication-phone-invalid-cert-hash) – Ashvin solanki Aug 15 '22 at 13:45
  • @Ashvinsolanki Unfortunately no, have tried those steps and variations to get it working. – meds Aug 15 '22 at 13:58

1 Answers1

1

Looks like this is a lesson in reading documentation more carefully - when uploading an app bundle to play services google looks to be resigning the app: https://developers.google.com/android/guides/client-auth

If you've published your app using Play App Signing, a requirement when using Android App Bundle, you can get your SHA-1 from the Google Play Console on the Release > Setup > App Integrity page.

Adding the sha-1/256 keys from there to firebase fixed the issue. Previously I was only adding the release keys from the certificate I had created locally.

meds
  • 21,699
  • 37
  • 163
  • 314