authenticate

abstract suspend fun authenticate(request: IB2BOTPsEmailDiscoveryAuthenticateParameters): B2BOTPsEmailDiscoveryAuthenticateResponse

Authenticates the discovery email OTP, returning an intermediate session token and the list of discovered organizations. Calls the POST /sdk/v1/b2b/otps/email/discovery/authenticate endpoint.

Kotlin:

StytchB2B.otp.email.discovery.authenticate(
B2BOTPsEmailDiscoveryAuthenticateParameters(
emailAddress = "user@example.com",
code = "123456",
)
)

iOS:

let params = B2BOTPsEmailDiscoveryAuthenticateParameters(
emailAddress: "user@example.com",
code: "123456"
)
let response = try await StytchB2B.otp.email.discovery.authenticate(params)

React Native:

StytchB2B.otp.email.discovery.authenticate({ emailAddress: "user@example.com", code: "123456" })

Return

B2BOTPsEmailDiscoveryAuthenticateResponse containing an intermediate session token and a list of discovered organizations.

Parameters

request
  • IB2BOTPsEmailDiscoveryAuthenticateParameters

  • emailAddress — The email address that received the discovery OTP.

  • code — The OTP code submitted by the user.

Throws

StytchError

if the code is invalid or expired.

if the coroutine is cancelled.