If the action state is CHALLENGE_REQUIRED, proceed with the SMS OTP challenge:
Copy
Ask AI
import { Authsignal } from '@authsignal/browser';const authsignal = new Authsignal({ tenantId: 'YOUR_TENANT_ID',});// Set the token from the track responseauthsignal.setToken(token);// Send the SMS OTP challengeconst challengeResponse = await authsignal.sms.challenge();// After user enters the OTP code in your UIconst verifyResponse = await authsignal.sms.verify({ code: otpCode});// Get the verification token to validate on your backendif (verifyResponse.data?.isVerified) { const verificationToken = verifyResponse.data.token;}
Copy
Ask AI
import { Authsignal } from '@authsignal/browser';const authsignal = new Authsignal({ tenantId: 'YOUR_TENANT_ID',});// Set the token from the track responseauthsignal.setToken(token);// Send the SMS OTP challengeconst challengeResponse = await authsignal.sms.challenge();// After user enters the OTP code in your UIconst verifyResponse = await authsignal.sms.verify({ code: otpCode});// Get the verification token to validate on your backendif (verifyResponse.data?.isVerified) { const verificationToken = verifyResponse.data.token;}
Copy
Ask AI
import { Authsignal } from '@authsignal/browser';const authsignal = new Authsignal({ tenantId: 'YOUR_TENANT_ID',});// Launch the prebuilt UI with the URL from the track responseconst result = await authsignal.launch(url, { mode: 'popup', popupOptions: { width: '400px', isClosable: true, }});// Get the verification token to validate on your backendif (result.token) { const verificationToken = result.token;}
WhatsApp can be used as a cost-effective fallback option for SMS delivery, helping reduce messaging costs while maintaining reliable OTP delivery. You can configure it in the Authsignal Portal.