authenticate
abstract suspend fun authenticate(request: IB2BOTPsSMSAuthenticateParameters): B2BOTPsSMSAuthenticateResponse
Authenticates an SMS OTP code submitted by the member, completing the MFA step. Calls the POST /sdk/v1/b2b/otps/sms/authenticate endpoint. Automatically includes the intermediate session token if one is present.
Kotlin:
StytchB2B.otp.sms.authenticate(
B2BOTPsSMSAuthenticateParameters(
organizationId = "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
memberId = "member-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
code = "123456",
sessionDurationMinutes = 30,
)
)Content copied to clipboard
iOS:
let params = B2BOTPsSMSAuthenticateParameters(
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
memberId: "member-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
code: "123456",
sessionDurationMinutes: 30
)
let response = try await StytchB2B.otp.sms.authenticate(params)Content copied to clipboard
React Native:
StytchB2B.otp.sms.authenticate({
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
memberId: "member-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
code: "123456",
sessionDurationMinutes: 30,
})Content copied to clipboard
Return
B2BOTPsSMSAuthenticateResponse containing the authenticated member session.
Parameters
request
IB2BOTPsSMSAuthenticateParameters
organizationId— The ID of the organization.memberId— The ID of the member authenticating.code— The OTP code the member received via SMS.sessionDurationMinutes— Duration of the session to create, in minutes.setMfaEnrollment?— Whether to enroll or unenroll the member's MFA method ("enroll"or"unenroll").
Throws
StytchError
if the code is invalid or expired.
if the coroutine is cancelled.