exchange

abstract suspend fun exchange(request: IB2BDiscoveryIntermediateSessionsExchangeParameters): B2BDiscoveryIntermediateSessionsExchangeResponse

Exchanges an intermediate session token for a full member session in the selected organization. Calls the POST /sdk/v1/b2b/discovery/intermediate_sessions/exchange endpoint. Automatically includes the intermediate session token if one is present.

Kotlin:

StytchB2B.discovery.intermediateSessions.exchange(
B2BDiscoveryIntermediateSessionsExchangeParameters(
organizationId = "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
sessionDurationMinutes = 30,
)
)

iOS:

let params = B2BDiscoveryIntermediateSessionsExchangeParameters(
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
sessionDurationMinutes: 30
)
let response = try await StytchB2B.discovery.intermediateSessions.exchange(params)

React Native:

StytchB2B.discovery.intermediateSessions.exchange({
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
sessionDurationMinutes: 30,
})

Return

B2BDiscoveryIntermediateSessionsExchangeResponse containing the full member session.

Parameters

request
  • IB2BDiscoveryIntermediateSessionsExchangeParameters

  • organizationId — The ID of the organization to join.

  • sessionDurationMinutes — Duration of the session to create, in minutes.

  • locale? — Locale for any follow-up communications.

Throws

StytchError

if the exchange fails or no intermediate session token is present.

if the coroutine is cancelled.