createConnection

abstract suspend fun createConnection(request: IB2BCreateExternalConnectionParameters): B2BCreateExternalConnectionResponse

Creates a new external SSO connection for the organization. Calls the POST /sdk/v1/b2b/sso/external endpoint. Requires an active session.

Kotlin:

StytchB2B.sso.external.createConnection(
B2BCreateExternalConnectionParameters(
externalConnectionId = "ext-conn-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
externalOrganizationId = "ext-org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
)
)

iOS:

let params = B2BCreateExternalConnectionParameters(
externalConnectionId: "ext-conn-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
externalOrganizationId: "ext-org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0"
)
let response = try await StytchB2B.sso.external.createConnection(params)

React Native:

StytchB2B.sso.external.createConnection({
externalConnectionId: "ext-conn-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
externalOrganizationId: "ext-org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
})

Return

B2BCreateExternalConnectionResponse containing the newly created connection.

Parameters

request
  • IB2BCreateExternalConnectionParameters

  • externalConnectionId — The ID of the external SSO connection in the partner organization.

  • externalOrganizationId — The ID of the partner organization.

  • displayName? — Human-readable label for the connection.

Throws

StytchError

if the request fails.

if the coroutine is cancelled.