Skip to main content
All Web SDK methods for email OTP require you to initiate an action first. Check out our guide on email OTP authentication for more details.

Enroll

Start enrollment for a new email OTP authenticator by sending the user an email containing an OTP code. This method is typically used when you’ve not yet verified the user’s email address.
const response = await authsignal.email.enroll({ email: "jane.smith@authsignal.com" });
If you’ve already verified a user’s email address independently of Authsignal, you can alternatively use a Server SDK to [enroll the user programmatically]/advanced-usage/programmatic-authenticator-management).

Parameters

email
string
The user’s email address.

Response

response
AuthsignalResponse<EnrollResponse>

Challenge

Start re-authentication for an existing email OTP authenticator by sending the user an email containing an OTP code. This method is typically used when you’ve already verified the user’s email address.
const response = await authsignal.email.challenge();

Response

response
AuthsignalResponse<ChallengeResponse>

Verify

Finish enrolling or re-authenticating a new or existing email OTP authenticator by verifying the code submitted by the user.
const response = await authsignal.email.verify({ code: "123456" });

Parameters

code
string
The OTP code inputted by the user.

Response

response
AuthsignalResponse<VerifyResponse>
data
VerifyResponse