Discovery

interface Discovery

The Discovery interface provides methods for discovering a member's available organizations, creating organizations, and exchanging sessions between organizations. The Discovery product lets End Users discover and log in to Organizations they are a Member of, invited to, or eligible to join.

Unlike our other B2B products, Discovery allows End Users to authenticate without specifying an Organization in advance. This is done via a Discovery Magic Link flow. After an End User is authenticated, an Intermediate Session is returned along with a list of associated Organizations.

The End User can then authenticate to the desired Organization by passing the Intermediate Session and organization_id. End users can even create a new Organization instead of joining or logging in to an existing one.

Call the StytchB2BClient.discovery.organizations() method to find a member's available organizations.

Call the StytchB2BClient.discovery.exchangeSession() method to exchange a session between organizations.

Call the StytchB2BClient.discovery.create() method to create a new organization.

Types

Link copied to clipboard
data class CreateOrganizationParameters(val organizationName: String? = null, val organizationSlug: String? = null, val organizationLogoUrl: String? = null, val sessionDurationMinutes: UInt = Constants.DEFAULT_SESSION_TIME_MINUTES, val ssoJitProvisioning: SsoJitProvisioning? = null, val emailAllowedDomains: List<String>? = null, val emailJitProvisioning: EmailJitProvisioning? = null, val emailInvites: EmailInvites? = null, val authMethods: AuthMethods? = null, val allowedAuthMethods: List<AllowedAuthMethods>? = null)

A data class used for wrapping parameters used with creating organizations

Link copied to clipboard
data class SessionExchangeParameters(val organizationId: String, val sessionDurationMinutes: UInt = Constants.DEFAULT_SESSION_TIME_MINUTES)

Data class used for wrapping parameters used with exchanging sessions between organizations.

Functions

Link copied to clipboard

Create a new organization. If an end user does not want to join any already-existing organization, or has no possible organizations to join, this endpoint can be used to create a new Organization and Member. This operation consumes the Intermediate Session. This endpoint can also be used to start an initial session for the newly created member and organization.

Link copied to clipboard

Exchange an Intermediate Session for a fully realized Member Session in a desired Organization. This operation consumes the Intermediate Session. This endpoint can be used to accept invites and create new members via domain matching.

Link copied to clipboard

Discover a member's available organizations