Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Credentials Google Sign In Error: [16] Account reauth failed

Following the android guidelines to integrate Google Sign in with credentials api
Google Sign in with credentials manager

val credentialManager = CredentialManager.create(context)
val googleIdOption: GetSignInWithGoogleOption = 
GetSignInWithGoogleOption.Builder("web-client-id here")
  .build()
val request: GetCredentialRequest = 
GetCredentialRequest.Builder()
  .addCredentialOption(googleIdOption)
  .build()
coroutineScope.launch {
 try {
     val result = credentialManager.getCredential(
         request = request,
         context = context,
     )
     handleGoogleLoginResult(result)
 } catch (t: Throwable) {
     Log.d(TAG, t.message.toString())
 }
 }

I receive this error:

[16] Account reauth failed.

with type

GetCredentialException.TYPE_USER_CANCELED

The weird part is that in a test project this works with the same keys.
Anyone has encountered this issue before?
Note i use this in KMM project and compose

Edit: 31/07/2024
I found a solution

I had provided wrong sha-1 in google credentials. My project has a lot of modules so i accidentaly provided the sha-1 of another module

like image 315
Panos Makris Avatar asked Jan 28 '26 20:01

Panos Makris


2 Answers

For anyone coming across this who is using Flutter and Google / Firebase Auth and they encounter this when they go from local device / emulator testing to Google Play, this occurs because the SHA1 fingerprint is now different as Google Play takes care of signing your app for distribution for Play Store.

Solution - Get the new SHA1:

  1. Go to Play store and select Your App

  2. Go to Test and Release

  3. Go to App Integrity

  4. Scroll to Play App Signing (click settings to the right of the title)

  5. Copy the SHA1 fingerprint

  6. Go to Firebase Project Settings or Google Auth console where you define your SHA certificate fingerprints and add the new SHA1

Gets me every time.

like image 93
Kieran Goodary Avatar answered Jan 31 '26 19:01

Kieran Goodary


In my case, this issue was happening because I was using a testing project (instead of trying to implement it directly on my game), and this testing project I created with a different package name than the one used in the Google Cloud (Android Client Id).

I'm pretty sure the different SHA-1 was also an issue, but I started using the real project keystore in my testing project when trying to find the reason for [16] Account reauth failed. and have not tested again without the keystore.

like image 36
sandolkakos Avatar answered Jan 31 '26 19:01

sandolkakos