authentica.otp.send() delivers a code to your user, and authentica.otp.verify() checks the code they enter.
Send OTP
Parameters
Pass either
phone or email, matching the method. Passing both throws an AuthenticaValidationError and nothing is sent.
Examples
Response
Verify OTP
Parameters
Provide exactly one of
phone or email.
Examples
otp as a string, exactly as the user entered it. This preserves leading zeros. Do not assume a fixed code length.
Response
Handling a rejected code
A rejected code can come back in two ways, depending on the API response:- a normal result with
status: false, or - an
AuthenticaApiErrorwithstatus422.
A 422 does not always mean the code was mistyped. The code may have expired, or the request may have been rejected for another reason.