Interface OTP

  • All Implemented Interfaces:

    
    public interface OTP
    
                        

    The 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 class OTP.AuthParameters

      Data class used for wrapping parameters used with OTP authentication

      public interface OTP.SmsOTP

      Provides all possible ways to call SMS OTP endpoints

      public interface OTP.WhatsAppOTP

      Provides all possible ways to call WhatsApp OTP endpoints

      public interface OTP.EmailOTP

      Provides all possible ways to call Email OTP endpoints

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • 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 authenticate
        callback - 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