Nick
02/05/2024, 11:09 PMgetCredential()
I immediately get a NoCredentialException
with no bottom sheet sliding up or any other UI items.
The identity-samples repo contains the CredentialManager
project--I can insert the code snippet in onCreate()
and everything works as expected--the bottom sheet slides up and exposes a number of accounts available on my system and I can continue the sign-in flow. That project uses xml views, though, and not compose.
I tried to insert the same get credential code in the Now In Android app, which does use compose, and I get the same NoCredentialException
. Is there a compose feature I need to enable to get this to work? I’ll continue trying to put together a trivial example, but if you’re aware of one sitting around, I’d really appreciate it. Am I barking up the wrong tree?Nick
02/05/2024, 11:09 PMval cm = androidx.credentials.CredentialManager.create(this)
lifecycleScope.launch {
val getPublicKeyCredentialOption =
GetGoogleIdOption.Builder()
.setFilterByAuthorizedAccounts(false)
.setServerClientId("hello")
.build()
try {
cm.getCredential(
context = this@NiaCatalogActivity,
request = androidx.credentials.GetCredentialRequest(
listOf(
getPublicKeyCredentialOption,
// getPasswordOption
)
)
)
} catch (e: Exception) {
Log.e("Auth", "getCredential failed with exception: $e")
}
}
ephemient
02/06/2024, 3:57 AMNick
02/06/2024, 3:58 AMtimwie
02/21/2024, 5:21 PMNick
02/21/2024, 6:14 PM10: Developer console is not set up correctly.
(instead of NoCredentialsAvailable
). TL;DR: the SHA-256 certificate fingerprint is insufficient to allow credential manager to work--it needs to have the SHA-1 in there as well. Hope this helps, and good luck!