loginOrSignup

abstract suspend fun loginOrSignup(request: IB2BOTPsEmailLoginOrSignupParameters): B2BOTPsEmailLoginOrSignupResponse

Sends an email OTP to the provided address for login or signup within the organization. Calls the POST /sdk/v1/b2b/otps/email/login_or_signup endpoint.

Kotlin:

StytchB2B.otp.email.loginOrSignup(
B2BOTPsEmailLoginOrSignupParameters(
organizationId = "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress = "user@example.com",
)
)

iOS:

let params = B2BOTPsEmailLoginOrSignupParameters(
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress: "user@example.com"
)
let response = try await StytchB2B.otp.email.loginOrSignup(params)

React Native:

StytchB2B.otp.email.loginOrSignup({
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress: "user@example.com",
})

Return

B2BOTPsEmailLoginOrSignupResponse confirming the OTP email was sent.

Parameters

request
  • IB2BOTPsEmailLoginOrSignupParameters

  • organizationId — The ID of the organization.

  • emailAddress — The email address to send the OTP to.

  • loginTemplateId? — Custom email template ID for the login OTP email.

  • signupTemplateId? — Custom email template ID for the signup OTP email.

  • locale? — Locale for the email content.

  • loginExpirationMinutes? — Expiration for the login OTP, in minutes.

  • signupExpirationMinutes? — Expiration for the signup OTP, in minutes.

Throws

StytchError

if the request fails.

if the coroutine is cancelled.