Pascal

Pascal

SMS OTP

OTP

One Time Password (OTP) helps in confirming one's phone number. It can used in the following ways:

  • Two-factor authentication
  • Phone number verification
  • Account recovery
  • Payment confirmation

OTP is not as robust as WebAuthn method though.

Some best practices when implementing OTP using the input element:

  • type="text" instead of type="number"
  • inputmode="numeric"
  • autocomplete="one-time-code"

JavaScript code can be used to wait for the SMS and complete the input using Web OTP API.