loginOrCreate
abstract suspend fun loginOrCreate(request: IOTPsWhatsAppLoginOrCreateParameters): OTPsWhatsAppLoginOrCreateResponse
Sends a one-time passcode via WhatsApp to the provided phone number, logging in an existing user or creating a new one. Calls the POST /sdk/v1/otps/whatsapp/login_or_create endpoint.
Kotlin:
StytchConsumer.otps.whatsapp.loginOrCreate(
OTPsWhatsAppLoginOrCreateParameters(phoneNumber = "+15005550006")
)Content copied to clipboard
iOS:
let params = OTPsWhatsAppLoginOrCreateParameters(phoneNumber: "+15005550006")
let response = try await StytchConsumer.otps.whatsapp.loginOrCreate(params)Content copied to clipboard
React Native:
StytchConsumer.otps.whatsapp.loginOrCreate({ phoneNumber: "+15005550006" })Content copied to clipboard
Return
OTPsWhatsAppLoginOrCreateResponse containing the methodId needed for OtpClient.authenticate.
Parameters
request
IOTPsWhatsAppLoginOrCreateParameters
phoneNumber— The phone number to send the OTP to, in E.164 format (e.g."+15005550006").expirationMinutes?— Expiration for the OTP, in minutes.locale?— Locale used for the message (e.g."en").
Throws
StytchError
if the request fails.
if the coroutine is cancelled.