stevdza-san / OneTapCompose

This library allow you to easily integrate One-Tap Sign in with Google(Credential Manager) in your project with Jetpack Compose. It keeps away all the boilerplate code.
Apache License 2.0
217 stars 15 forks source link

No credentials available not works #33

Open Yetland opened 1 month ago

Yetland commented 1 month ago

You should't catch exception with message 'No credentials available'. When i did't login any google account, it throw a exception message 'During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.' and the exception type is NoCredentialException. Plz fix your exception catch. image image

stevdza-san commented 1 month ago

You're referring to a fact that you're not able to see "NoCredentialException", but only the error message. Am I correct?

Yetland commented 1 month ago

After my test in different devices(samsung/xiaomi), My xiaomi's expcetion msg is "No credentials available" but samsung's is "During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.". So your judgement condition should be replaced.

 when (e) {
                        is NoCredentialException -> {
                            handleCredentialsNotAvailable(
                                context = context,
                                state = state,
                                credentialManager = credentialManager,
                                clientId = clientId,
                                nonce = nonce,
                                onTokenIdReceived = onTokenIdReceived,
                                onDialogDismissed = onDialogDismissed
                            )
                        }

                        is GetCredentialCancellationException -> {
                            state.close()
                        }

                        is GetCredentialInterruptedException -> {
                            state.close()
                        }

                        else -> {
                            e.localizedMessage?.let { onDialogDismissed(it) }
                            state.close()
                        }
                    }
stevdza-san commented 1 month ago

"No credentials available" message indicates that Credential Manager is not available on that device (Xiaomi). And that second error on samsung device, probably indicates that the google account was not found on a device. Xiaomi devices do have an issue with Credential Manager sadly.

Yetland commented 1 month ago

https://stackoverflow.com/questions/78257334/android-credential-manager-issue-nocredentialexception-during-begin-sign-in-f https://stackoverflow.com/questions/61768804/getting-16-cannot-find-a-matching-credential-when-doing-one-tap-sign-in-and-s

jaomanoel commented 3 weeks ago

Through testing on a Xiaomi device, I discovered that the Google API may not function properly if there are more than six Google accounts on the phone.

kelvin-dev commented 3 weeks ago
2024-08-18 08:42:46.908 12107-12107 OneTapCompose           com.stevdzasan.onetapcompose         E  GetCredentialException: androidx.credentials.exceptions.NoCredentialException: During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.
2024-08-18 08:42:46.908 12107-12107 MainActivity            com.stevdzasan.onetapcompose         D  androidx.credentials.exceptions.NoCredentialException: During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.
2024-08-18 08:42:47.200  1966-3974  AuthPII                 com.google.android.gms.persistent    E  [RequestTokenManager] getToken() -> BAD_AUTHENTICATION. App: com.stevdzasan.onetapcompose, Service: oauth2:openid
                                                                                                    amuc: Long live credential not available.
                                                                                                        at ubm.a(:com.google.android.gms@242632016@24.26.32 (040700-650348549):971)
                                                                                                        at ubs.b(:com.google.android.gms@242632016@24.26.32 (040700-650348549):28)
                                                                                                        at ubq.a(:com.google.android.gms@242632016@24.26.32 (040700-650348549):623)
                                                                                                        at tux.j(:com.google.android.gms@242632016@24.26.32 (040700-650348549):3)
                                                                                                        at yrc.i(:com.google.android.gms@242632016@24.26.32 (040700-650348549):19)
                                                                                                        at yrc.fc(:com.google.android.gms@242632016@24.26.32 (040700-650348549):1347)
                                                                                                        at ocs.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):97)
                                                                                                        at android.os.Binder.transact(Binder.java:499)
                                                                                                        at biqs.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):10)
                                                                                                        at android.os.Binder.transact(Binder.java:499)
                                                                                                        at bbai.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):148)
                                                                                                        at android.os.Binder.execTransact(Binder.java:565)
2024-08-18 08:42:47.204  1966-2623  AuthPII                 com.google.android.gms.persistent    E  [RequestTokenManager] getToken() -> BAD_AUTHENTICATION. App: com.stevdzasan.onetapcompose, Service: oauth2:openid
                                                                                                    amuc: Long live credential not available.
                                                                                                        at ubm.a(:com.google.android.gms@242632016@24.26.32 (040700-650348549):971)
                                                                                                        at ubs.b(:com.google.android.gms@242632016@24.26.32 (040700-650348549):28)
                                                                                                        at ubq.a(:com.google.android.gms@242632016@24.26.32 (040700-650348549):623)
                                                                                                        at tux.j(:com.google.android.gms@242632016@24.26.32 (040700-650348549):3)
                                                                                                        at yrc.i(:com.google.android.gms@242632016@24.26.32 (040700-650348549):19)
                                                                                                        at yrc.fc(:com.google.android.gms@242632016@24.26.32 (040700-650348549):1347)
                                                                                                        at ocs.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):97)
                                                                                                        at android.os.Binder.transact(Binder.java:499)
                                                                                                        at biqs.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):10)
                                                                                                        at android.os.Binder.transact(Binder.java:499)
                                                                                                        at bbai.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):148)
                                                                                                        at android.os.Binder.execTransact(Binder.java:565)
2024-08-18 08:42:47.208  1966-1984  AuthPII                 com.google.android.gms.persistent    E  [RequestTokenManager] getToken() -> BAD_AUTHENTICATION. App: com.stevdzasan.onetapcompose, Service: oauth2:openid
                                                                                                    amuc: Long live credential not available.
                                                                                                        at ubm.a(:com.google.android.gms@242632016@24.26.32 (040700-650348549):971)
                                                                                                        at ubs.b(:com.google.android.gms@242632016@24.26.32 (040700-650348549):28)
                                                                                                        at ubq.a(:com.google.android.gms@242632016@24.26.32 (040700-650348549):623)
                                                                                                        at tux.j(:com.google.android.gms@242632016@24.26.32 (040700-650348549):3)
                                                                                                        at yrc.i(:com.google.android.gms@242632016@24.26.32 (040700-650348549):19)
                                                                                                        at yrc.fc(:com.google.android.gms@242632016@24.26.32 (040700-650348549):1347)
                                                                                                        at ocs.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):97)
                                                                                                        at android.os.Binder.transact(Binder.java:499)
                                                                                                        at biqs.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):10)
                                                                                                        at android.os.Binder.transact(Binder.java:499)
                                                                                                        at bbai.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):148)
                                                                                                        at android.os.Binder.execTransact(Binder.java:565)
2024-08-18 08:42:47.212  1966-2721  AuthPII                 com.google.android.gms.persistent    E  [RequestTokenManager] getToken() -> BAD_AUTHENTICATION. App: com.stevdzasan.onetapcompose, Service: oauth2:openid
                                                                                                    amuc: Long live credential not available.
                                                                                                        at ubm.a(:com.google.android.gms@242632016@24.26.32 (040700-650348549):971)
                                                                                                        at ubs.b(:com.google.android.gms@242632016@24.26.32 (040700-650348549):28)
                                                                                                        at ubq.a(:com.google.android.gms@242632016@24.26.32 (040700-650348549):623)
                                                                                                        at tux.j(:com.google.android.gms@242632016@24.26.32 (040700-650348549):3)
                                                                                                        at yrc.i(:com.google.android.gms@242632016@24.26.32 (040700-650348549):19)
                                                                                                        at yrc.fc(:com.google.android.gms@242632016@24.26.32 (040700-650348549):1347)
                                                                                                        at ocs.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):97)
                                                                                                        at android.os.Binder.transact(Binder.java:499)
                                                                                                        at biqs.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):10)
                                                                                                        at android.os.Binder.transact(Binder.java:499)
                                                                                                        at bbai.onTransact(:com.google.android.gms@242632016@24.26.32 (040700-650348549):148)
                                                                                                        at android.os.Binder.execTransact(Binder.java:565)
2024-08-18 08:42:47.224 12107-12107 OneTapCompose           com.stevdzasan.onetapcompose         E  GetCredentialException: androidx.credentials.exceptions.NoCredentialException: During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.
2024-08-18 08:42:47.224 12107-12107 MainActivity            com.stevdzasan.onetapcompose         D  androidx.credentials.exceptions.NoCredentialException: During begin sign in, failure response from one tap: 16: [28433] Cannot find a matching credential.
jaomanoel commented 3 weeks ago

"Cannot find a matching credential" message indicates that no Google account is available on the device.

kelvin-dev commented 3 weeks ago

"Cannot find a matching credential" message indicates that no Google account is available on the device.

we have 5 existing google accounts on the sample device

kelvin-dev commented 3 weeks ago

https://issuetracker.google.com/issues/356428986