authenticate

abstract suspend fun authenticate(request: IB2BPasswordDiscoveryAuthenticateParameters): B2BPasswordDiscoveryAuthenticateResponse

Authenticates an email and password credential during the cross-org discovery flow, before an organization is selected. Calls the POST /sdk/v1/b2b/passwords/discovery/authenticate endpoint. Returns discovered organizations and an intermediate session token; call B2BDiscoveryIntermediateSessionsClient.exchange to establish a full member session.

Kotlin:

StytchB2B.discovery.passwords.authenticate(
B2BPasswordDiscoveryAuthenticateParameters(
emailAddress = "user@example.com",
password = "correct-horse-battery-staple",
)
)

iOS:

let params = B2BPasswordDiscoveryAuthenticateParameters(
emailAddress: "user@example.com",
password: "correct-horse-battery-staple"
)
let response = try await StytchB2B.discovery.passwords.authenticate(params)

React Native:

StytchB2B.discovery.passwords.authenticate({
emailAddress: "user@example.com",
password: "correct-horse-battery-staple",
})

Return

B2BPasswordDiscoveryAuthenticateResponse containing discovered organizations and an intermediate session token.

Parameters

request
  • IB2BPasswordDiscoveryAuthenticateParameters

  • emailAddress — The user's email address.

  • password — The user's password.

Throws

StytchError

if the credentials are invalid.

if the coroutine is cancelled.