StytchB2B

interface StytchB2B : StytchClient

Main entry point for the Stytch B2B SDK.

Provides access to all B2B authentication methods and session management. Create an instance with createStytchB2B.

Properties

Link copied to clipboard

A StateFlow emitting the current authentication state whenever it changes.

Link copied to clipboard
abstract val dfp: DFPClient

Device fingerprinting (DFP) methods.

Link copied to clipboard

Cross-org discovery flow methods for listing and joining organizations.

Link copied to clipboard

Magic link authentication methods.

Link copied to clipboard

Member management methods.

Link copied to clipboard
abstract val oauth: B2BOAuthClient

OAuth authentication methods.

Link copied to clipboard

Organization management methods.

Link copied to clipboard
abstract val otp: B2BOtpClient

OTP (SMS and email) authentication methods.

Link copied to clipboard

Password-based authentication methods.

Link copied to clipboard
abstract val rbac: B2BRBACClient

Role-based access control (RBAC) methods.

Link copied to clipboard

Recovery code management methods.

Link copied to clipboard
abstract val scim: B2BSCIMClient

SCIM provisioning methods.

Link copied to clipboard

Session management methods.

Link copied to clipboard
abstract val sso: B2BSSOClient

SSO authentication methods.

Link copied to clipboard
abstract val totp: B2BTOTPClient

TOTP authenticator methods.

Functions

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

Handles an incoming deeplink URL, authenticating the token it contains if possible.

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

Subscribes to authentication state changes via a callback. Returns a JsCleanup whose JsCleanup.stop cancels the subscription.

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

Returns the current PKCE code pair if one exists (used for advanced manual flows).

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 a DeeplinkToken if it contains a Stytch token, or null otherwise.