authenticate
abstract suspend fun authenticate(request: IB2BOTPsEmailAuthenticateParameters): B2BOTPsEmailAuthenticateResponse
Authenticates an email OTP code submitted by the member, completing the authentication step. Calls the POST /sdk/v1/b2b/otps/email/authenticate endpoint. Automatically includes the intermediate session token if one is present.
Kotlin:
StytchB2B.otp.email.authenticate(
B2BOTPsEmailAuthenticateParameters(
organizationId = "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress = "user@example.com",
code = "123456",
sessionDurationMinutes = 30,
)
)Content copied to clipboard
iOS:
let params = B2BOTPsEmailAuthenticateParameters(
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress: "user@example.com",
code: "123456",
sessionDurationMinutes: 30
)
let response = try await StytchB2B.otp.email.authenticate(params)Content copied to clipboard
React Native:
StytchB2B.otp.email.authenticate({
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress: "user@example.com",
code: "123456",
sessionDurationMinutes: 30,
})Content copied to clipboard
Return
B2BOTPsEmailAuthenticateResponse containing the authenticated member session.
Parameters
request
IB2BOTPsEmailAuthenticateParameters
organizationId— The ID of the organization.emailAddress— The email address that received the OTP.code— The OTP code submitted by the member.sessionDurationMinutes— Duration of the session to create, in minutes.locale?— Locale for any follow-up communications.
Throws
StytchError
if the code is invalid or expired.
if the coroutine is cancelled.