Assigned
Status Update
Comments
bl...@google.com <bl...@google.com> #2
Automated by Blunderbuss job android-credential-manager-autoassigner for config android_credman_config for component 1301097.
jb...@google.com <jb...@google.com>
da...@google.com <da...@google.com> #3
The error you posted state "activity is cancelled by the user". This implies the request was cancelled somehow during the request.
Can you grab a bugreport and attach it to this bug?
xw...@gmail.com <xw...@gmail.com> #4
It's just pulling up google sign in and then selecting an account, and it gives me this error.
xw...@gmail.com <xw...@gmail.com> #5
Video attached
da...@google.com <da...@google.com> #6
Hmm that seems odd. Can you attach a bugreport for us to look into?
Description
Version used:
implementation "androidx.credentials:credentials:1.3.0"
implementation "androidx.credentials:credentials-play-services-auth:1.3.0"
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
Devices/Android versions reproduced on:
android13
If this is a bug in the library, we would appreciate if you could attach:
@JvmStatic
fun login(
activityContext: Activity,
lifecycleScope: LifecycleCoroutineScope,
listener: OnGoogleLoginListener
) {
val request: GetCredentialRequest = GetCredentialRequest.Builder()
.addCredentialOption(createGoogleIdOption(activityContext))
.build()
credentialManager = CredentialManager.create(activityContext)
lifecycleScope.launch {
try {
val result = credentialManager?.getCredential(
request = request,
context = activityContext,
)
result?.let { handleSignIn(it, listener) }
} catch (e: GetCredentialException) {
if (e.message != null) {
if (e.message!!.contains("No credentials available")) {
handleCredentialsNotAvailable(activityContext,lifecycleScope,
credentialManager!!,listener)
return@launch
}
handleFailure(e,listener)
}
}
}
}
private fun createGoogleIdOption(context: Activity): GetGoogleIdOption {
return GetGoogleIdOption.Builder()
.setFilterByAuthorizedAccounts(false)
.setServerClientId(context.getString(R.string.default_web_client_id))
.build()
}