The PhoneIdentifierChallenge class implements the phone-identifier-challenge screen functionality. This screen prompts the user to enter a verification code sent to their phone number to confirm their identity.
Create an instance of PhoneIdentifierChallenge screen manager
Example
import PhoneIdentifierChallenge from '@auth0/auth0-acul-js/phone-identifier-challenge';const phoneIdentifierChallenge = new PhoneIdentifierChallenge();phoneIdentifierChallenge.submitPhoneChallenge({ code: "<string>"});
This method submits the phone verification code to complete the challenge.
Example
import PhoneIdentifierChallenge from '@auth0/auth0-acul-js/phone-identifier-challenge';const phoneIdentifierChallenge = new PhoneIdentifierChallenge();phoneIdentifierChallenge.submitPhoneChallenge({ code: "<string>"});
This method resends the verification code to the user’s phone number.
Example
import PhoneIdentifierChallenge from '@auth0/auth0-acul-js/phone-identifier-challenge';const phoneIdentifierChallenge = new PhoneIdentifierChallenge();phoneIdentifierChallenge.resendCode();
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 PhoneIdentifierChallenge from '@auth0/auth0-acul-js/phone-identifier-challenge'; const handleStatusChange = (remainingSeconds, isDisabled) => { setDisabled(isDisabled); setRemaining(remainingSeconds); }; const handleTimeout = () => { console.log('Timeout completed, resend is now available'); }; const { startResend } = phoneChallenge.resendManager({ timeoutSeconds: 30, onStatusChange: handleStatusChange, onTimeout: handleTimeout }); // Call startResend when user clicks resend button await startResend();
This method switches the delivery method for the verification code to SMS text message.
Example
import PhoneIdentifierChallenge from '@auth0/auth0-acul-js/phone-identifier-challenge';const phoneIdentifierChallenge = new PhoneIdentifierChallenge();phoneIdentifierChallenge.switchToText();
This method switches the delivery method for the verification code to a voice call.
Example
import PhoneIdentifierChallenge from '@auth0/auth0-acul-js/phone-identifier-challenge';const phoneIdentifierChallenge = new PhoneIdentifierChallenge();phoneIdentifierChallenge.switchToVoice();
This method navigates the user back to the previous screen.
Example
import PhoneIdentifierChallenge from '@auth0/auth0-acul-js/phone-identifier-challenge';const phoneIdentifierChallenge = new PhoneIdentifierChallenge();phoneIdentifierChallenge.returnToPrevious();