DefaultWebAuthenticationProvider
Default WebAuthenticationProvider implementation that launches the OIDC redirect flow using Chrome Custom Tabs, preferring Chrome's Auth Tab (a Custom Tabs variant purpose-built for auth redirect flows) when the resolved browser supports it.
Browser selection and tab appearance are configured via constructor parameters rather than event handlers. Use preferredBrowsers to control which browser is chosen, queryIntentServicesFlags to adjust the package-manager query, browserSelector to fully override browser selection, customizeTabsIntent to style the Chrome Custom Tab (toolbar color, animations, close button icon, etc.), and customizeAuthTabIntent for the equivalent Auth Tab customization.
val provider = DefaultWebAuthenticationProvider(
preferredBrowsers = listOf("com.android.chrome"),
customizeTabsIntent = { context, builder ->
builder.setToolbarColor(ContextCompat.getColor(context, R.color.brand_primary))
}
)
val webAuth = WebAuthentication(client, provider)Constructors
Properties
The list of browser package names to prefer when selecting which Chrome Custom Tabs implementation is used. Checked in order; the first installed match wins.
Flags passed to android.content.pm.PackageManager.queryIntentServices when querying for Chrome Custom Tabs intent services. Ignored if browserSelector is overridden.
Functions
Launches the OIDC redirect flow associated with a WebAuthentication.
Launches the OIDC redirect flow via Auth Tab, or falls back to WebAuthenticationProvider.launchCustomTab if the resolved browser doesn't support it.
Launches the OIDC redirect flow associated with a WebAuthentication and wraps launch success/failure in a Result.