Interface OTP
-
- All Implemented Interfaces:
public interface OTPThe OTP interface provides methods for sending and authenticating One-Time Passcodes (OTP) via SMS, WhatsApp, and Email.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classOTP.AuthParametersData class used for wrapping parameters used with OTP authentication
public interfaceOTP.SmsOTPProvides all possible ways to call SMS OTP endpoints
public interfaceOTP.WhatsAppOTPProvides all possible ways to call WhatsApp OTP endpoints
public interfaceOTP.EmailOTPProvides all possible ways to call Email OTP endpoints
-
Method Summary
Modifier and Type Method Description abstract StytchResult<IAuthData>authenticate(OTP.AuthParameters parameters)Authenticate a user given a method_id (the associated email_id or phone_id) and a code. abstract Unitauthenticate(OTP.AuthParameters parameters, Function1<StytchResult<IAuthData>, Unit> callback)Authenticate a user given a method_id (the associated email_id or phone_id) and a code. abstract CompletableFuture<StytchResult<IAuthData>>authenticateCompletable(OTP.AuthParameters parameters)Authenticate a user given a method_id (the associated email_id or phone_id) and a code. abstract OTP.SmsOTPgetSms()Public variable that exposes an instance of SMS OTP abstract OTP.WhatsAppOTPgetWhatsapp()Public variable that exposes an instance of WhatsApp OTP abstract OTP.EmailOTPgetEmail()Public variable that exposes an instance of Email OTP -
-
Method Detail
-
authenticate
abstract StytchResult<IAuthData> authenticate(OTP.AuthParameters parameters)
Authenticate a user given a method_id (the associated email_id or phone_id) and a code. This endpoint verifies that the code is valid, hasn't expired or been previously used. A given method_id may only have a single active OTP code at any given time, if a user requests another OTP code before the first one has expired, the first one will be invalidated.
- Parameters:
parameters- required to authenticate- Returns:
AuthResponse
-
authenticate
abstract Unit authenticate(OTP.AuthParameters parameters, Function1<StytchResult<IAuthData>, Unit> callback)
Authenticate a user given a method_id (the associated email_id or phone_id) and a code. This endpoint verifies that the code is valid, hasn't expired or been previously used. A given method_id may only have a single active OTP code at any given time, if a user requests another OTP code before the first one has expired, the first one will be invalidated.
- Parameters:
parameters- required to authenticatecallback- that receives an AuthResponse
-
authenticateCompletable
abstract CompletableFuture<StytchResult<IAuthData>> authenticateCompletable(OTP.AuthParameters parameters)
Authenticate a user given a method_id (the associated email_id or phone_id) and a code. This endpoint verifies that the code is valid, hasn't expired or been previously used. A given method_id may only have a single active OTP code at any given time, if a user requests another OTP code before the first one has expired, the first one will be invalidated.
- Parameters:
parameters- required to authenticate- Returns:
AuthResponse
-
getSms
abstract OTP.SmsOTP getSms()
Public variable that exposes an instance of SMS OTP
-
getWhatsapp
abstract OTP.WhatsAppOTP getWhatsapp()
Public variable that exposes an instance of WhatsApp OTP
-
getEmail
abstract OTP.EmailOTP getEmail()
Public variable that exposes an instance of Email OTP
-
-
-
-