Choose an Email Provider you want to use in the next screen. You can choose Authsignal for development purposes, but it’s recommended not to use it in production. Then activate the email OTP.
If the action state is CHALLENGE_REQUIRED, proceed with the email 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 email OTP challengeconst challengeResponse = await authsignal.email.challenge();// After user enters the OTP code in your UIconst verifyResponse = await authsignal.email.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 email OTP challengeconst challengeResponse = await authsignal.email.challenge();// After user enters the OTP code in your UIconst verifyResponse = await authsignal.email.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;}