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