Skip to main content
The EmailOTPChallenge class implements the email-otp-challenge screen functionality. This screen prompts the user to enter a one-time passcode sent to their email address.

Constructors

Create an instance of EmailOTPChallenge screen manager
Example
import EmailOTPChallenge from '@auth0/auth0-acul-js/email-otp-challenge';

const emailOTPChallenge = new EmailOTPChallenge();
emailOTPChallenge.submitCode({
  code: '123456',
});

Properties

Provides branding-related configurations, such as branding theme and settings.
Provides client-related configurations, such as id, name, and logoUrl, for the email-otp-challenge screen.
Provides information about the user’s organization, such as organization id and name.
Contains data about the current prompt in the authentication flow.
Contains details specific to the email-otp-challenge screen, including its configuration and context.
Contains data related to the tenant, such as id and associated metadata.
Provides transaction-specific data for the email-otp-challenge screen, such as active identifiers and flow states.
Handles untrusted data passed to the SDK, such as user input during the email OTP challenge flow.
Details of the active user, including username, email, and roles.

Methods

submitCode
(options ?)
This method submits the OTP code entered by the user.
Example
import EmailOTPChallenge from '@auth0/auth0-acul-js/email-otp-challenge';

const emailOTPChallenge = new EmailOTPChallenge();
emailOTPChallenge.submitCode({
  code: '123456',
});
options
OPTIONAL
Optional payload.
resendCode
(options ?)
This method requests a new OTP code to be sent to the user’s email.
Example
import EmailOTPChallenge from '@auth0/auth0-acul-js/email-otp-challenge';

const emailOTPChallenge = new EmailOTPChallenge();
emailOTPChallenge.resendCode();
options
OPTIONAL
Optional payload.
resendManager
This method provides resend functionality with timeout management. It returns a ResendControl object with a startResend() method that triggers the resend and enforces a cooldown period before the user can resend again.
Example
import EmailOTPChallenge from '@auth0/auth0-acul-js/email-otp-challenge';

const emailOTPChallenge = new EmailOTPChallenge();
const { startResend } = emailOTPChallenge.resendManager({
  timeoutSeconds: 15,
  onStatusChange: (remainingSeconds, isDisabled) => {
    console.log(`Resend available in ${remainingSeconds}s, disabled: ${isDisabled}`);
  },
  onTimeout: () => {
    console.log('Resend is now available');
  }
});

// Call startResend when user clicks resend button
startResend();
options
OPTIONAL
Optional payload.
getErrors
This method retrieves the array of transaction errors from the context, or an empty array if none exist.