StytchConsumer

interface StytchConsumer : StytchClient

The main entry point for the Stytch Consumer SDK.

Properties

Link copied to clipboard

A StateFlow that emits the current authentication state whenever it changes.

Link copied to clipboard

Biometric authentication.

Link copied to clipboard
abstract val crypto: CryptoClient

Crypto wallet authentication.

Link copied to clipboard
abstract val dfp: DFPClient

Device fingerprinting (DFP) integration.

Link copied to clipboard

Magic link authentication.

Link copied to clipboard
abstract val oauth: OAuthClient

OAuth authentication (browser-based and native provider flows).

Link copied to clipboard
abstract val otp: OtpClient

OTP (one-time passcode) authentication via SMS, email, or WhatsApp.

Link copied to clipboard
abstract val passkeys: PasskeysClient

Passkey (WebAuthn) authentication.

Link copied to clipboard

Password-based authentication.

Link copied to clipboard
abstract val session: SessionClient

Session management.

Link copied to clipboard
abstract val totp: TOTPClient

TOTP (time-based one-time passcode) authentication.

Link copied to clipboard
abstract val user: UserClient

User account management.

Functions

Link copied to clipboard
abstract suspend fun authenticate(url: String, sessionDurationMinutes: Int?): DeeplinkAuthenticationStatus

Authenticates a Stytch deeplink URL, dispatching to the appropriate auth method based on the token type embedded in the URL. Returns DeeplinkAuthenticationStatus.ManualHandlingRequired for password reset tokens, which must be handled by the caller.

Link copied to clipboard
abstract fun authenticationStateObserver(callback: (authenticationState: ConsumerAuthenticationState) -> Unit): JsCleanup

Registers a callback that is invoked whenever the authentication state changes. Returns a JsCleanup that stops the observer when JsCleanup.stop is called.

Link copied to clipboard
abstract suspend fun getPKCECodePair(): PKCECodePair?

Returns the current PKCE code pair if one has been generated and not yet consumed.

Link copied to clipboard
abstract suspend fun hydrate(sessionToken: String)

Hydrates a session from a given session token

Link copied to clipboard
abstract fun parseDeeplink(url: String): DeeplinkToken?

Parses a URL and returns the Stytch token it contains, or null if the URL is not a recognized Stytch deeplink.