Whichever way I implement compose credential manager, I get an exception
GetCredentialCancellationException: activity is canceled by the user.
The manager shows a dialog with my Google accounts, I choose one and then there is a "consent screen" with a "continue as me" button. After clicking that, I get the exception above.
I don't know what I am doing wrong.
My libraries:
androidx.credentials.credentials:credentials:1.2.0-beta03
androidx.credentials.credentials:credentials-play-services-auth:1.2.0-beta03
com.google.android.gms:play-services-auth:20.7.0
The basic demo code:
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
lifecycleScope.launch {
CredentialManager.create([email protected]).getCredential(
context = this@MainActivity,
request = GetCredentialRequest(
listOf(
GetGoogleIdOption.Builder()
.setFilterByAuthorizedAccounts(false)
.setAutoSelectEnabled(false)
.setServerClientId("secret-id")
.build(),
)
),
).credential
}
setContent {
Text("DEMO")
}
}
}