Skip to content

Commit 927650d

Browse files
committed
fix(mobile): switch from GetGoogleIdOption to GetSignInWithGoogleOption
GetGoogleIdOption uses the One Tap UX which gets suppressed by Google based on authorization history and dismissal count, causing NoCredentialException even when a Google account exists on the device. GetSignInWithGoogleOption is designed for explicit button-triggered sign-in flows and always shows the full account picker without suppression or filtering by prior authorization status.
1 parent 006f504 commit 927650d

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎mobile/app/src/main/java/com/company/template/auth/FirebaseAuthRepository.kt‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import androidx.credentials.CustomCredential
99
import androidx.credentials.GetCredentialRequest
1010
import androidx.credentials.exceptions.NoCredentialException
1111
import com.company.template.BuildConfig
12-
import com.google.android.libraries.identity.googleid.GetGoogleIdOption
12+
import com.google.android.libraries.identity.googleid.GetSignInWithGoogleOption
1313
import com.google.android.libraries.identity.googleid.GoogleIdTokenCredential
1414
import com.google.firebase.auth.FirebaseAuth
1515
import com.google.firebase.auth.FirebaseUser
@@ -76,13 +76,11 @@ class FirebaseAuthRepository(
7676
}
7777

7878
val credentialManager = CredentialManager.create(activity)
79-
val googleIdOption = GetGoogleIdOption.Builder()
80-
.setFilterByAuthorizedAccounts(false)
81-
.setServerClientId(webClientId)
82-
.build()
79+
// GetSignInWithGoogleOption always shows the full account picker — no One Tap suppression
80+
val googleSignInOption = GetSignInWithGoogleOption.Builder(webClientId).build()
8381

8482
val request = GetCredentialRequest.Builder()
85-
.addCredentialOption(googleIdOption)
83+
.addCredentialOption(googleSignInOption)
8684
.build()
8785

8886
val credentialResult = try {

0 commit comments

Comments
 (0)