android / android/identity-samples

Authenticate users with Sign in with Google GetCredentialException:During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.

Open
#94 14 comments 7 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
515
Forks
283
Avg merge
9h 37m
Merged PRs (30d)
2

Description

----------------------------------------------------------------------------------------------------------------------
**dependent Sdk Version:**
implementation "androidx.credentials:credentials:1.3.0-rc01"
implementation "androidx.credentials:credentials-play-services-auth:1.3.0-rc01"
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
----------------------------------------------------------------------------------------------------------------------
**Test model:**
OPPO PDKM00 Android12
----------------------------------------------------------------------------------------------------------------------
**Problem occurred:**
GetCredentialException,
During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.
android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL
----------------------------------------------------------------------------------------------------------------------
**Operation steps when a problem occurs:**

Step 1:

Open phone settings->User and Account->Password and account Delete Google account

Step 2:

Refer to the official documentation to log in to Google
https://developer.android.com/identity/sign-in/credential-manager-siwg#siwg-button

The code is as follows:

private var mCm: CredentialManager? = null
fun initLogin(activity : FragmentActivity?){
mCm = CredentialManager.create(this)
}

fun login(activity : FragmentActivity?){
activity?.apply {
val googleIdOption: GetGoogleIdOption = GetGoogleIdOption.Builder()
.setFilterByAuthorizedAccounts(true)
.setServerClientId(serviceClientId)
.setAutoSelectEnabled(true)
.build()

val request: GetCredentialRequest = GetCredentialRequest.Builder()
.addCredentialOption(googleIdOption)
.build()

lifecycleScope.launch {
try {
val result = mCm?.getCredential(
request = request,
context = this@apply,
)
handleSignIn(result,this@apply)
} catch (e: GetCredentialException) {
**// During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.**
handleFailure(e)
**loginAgain(activity)**
}
}
}
}

fun loginAgain(activity : FragmentActivity?){

activity?.apply {
val googleIdOption: GetGoogleIdOption = GetGoogleIdOption.Builder()
**.setFilterByAuthorizedAccounts(false)**
.setServerClientId(defaultServiceClientId)
.build()

val request: GetCredentialRequest = GetCredentialRequest.Builder()
.addCredentialOption(googleIdOption)
.build()

lifecycleScope.launch {
try {
val result = mCm?.getCredential(
request = request,
context = this@apply,
)
handleSignIn(result,this@apply)
} catch (e: GetCredentialException) {
**// During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.**

}
}
}
}

----------------------------------------------------------------------------------------------------------------------
**Expected results:**
If none are found, prompt the user to sign up with their Google Account using setFilterByAuthorizedAccounts(false);
pop-up interface for entering Google account:

----------------------------------------------------------------------------------------------------------------------
**Actual results:**
Following the instructions in the document,
If no saved credentials are found (no Google Accounts returned by getGoogleIdOption), prompt your user to sign up. First, check if setFilterByAuthorizedAccounts(true) to see if any previously used accounts exist. If none are found, prompt the user to sign up with their Google Account using setFilterByAuthorizedAccounts(false);

an error still occurs,No pop-up interface for entering Google account:
exception occurred GetCredentialException,
During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential;
android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL;

Contributor guide

Open the contributing guide

Research direction

Reproduce the flow on the listed OPPO PDKM00 running Android 12 with the stated Credential Manager and Google Identity SDK versions, following the linked Sign in with Google documentation. Trace both getCredential calls and their TYPE_NO_CREDENTIAL handling, then verify that a user with no saved Google credentials reaches the account sign-up chooser instead of the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
authentication, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.