Aditi Dosi
3 min readOct 7, 2022
A one-time password, also known as a one-time PIN, one-time authorization code or dynamic password, is a password that is valid for only one login session or transaction, on a computer system or other digital device.

OTP security tokens are microprocessor-based smart cards or pocket-size key fobs that produce a numeric or alphanumeric code to authenticate access to the system or transaction. This secret code changes every 30 or 60 seconds, depending on how the token is configured.

Mobile device apps, such as Google Authenticator, rely on the token device and PIN to generate the one-time password for two-step verification.

OTP security tokens can be implemented using hardware, software or on demand. Unlike traditional passwords that remain static or expire every 30 to 60 days, the one-time password is used for one transaction or login session.

How to get a one-time password

When an unauthenticated user attempts to access a system or perform a transaction on a device, an authentication manager on the network server generates a number or shared secret, using one-time password algorithms. The same number and algorithm are used by the security token on the smart card or device to match and validate the one-time password and user.

Many companies use Short Message Service (SMS) to provide a temporary passcode via text for a second authentication factor. The temporary passcode is obtained out of band through cellphone communications after the user enters his username and password on networked information systems and transaction-oriented web applications.

For two-factor authentication (2FA), the user enters his user ID, traditional password and temporary passcode to access the account or system.

How a one-time password works

In OTP-based authentication methods, the user’s OTP app and the authentication server rely on shared secrets.

Values for one-time passwords are generated using the Hashed Message Authentication Code (HMAC) algorithm and a moving factor, such as time-based information (TOTP) or an event counter (HOTP).

The OTP values have minute or second timestamps for greater security. The one-time password can be delivered to a user through several channels, including an SMS-based text message, an email or a dedicated application on the endpoint.

Security professionals have long been concerned that SMS message spoofing and man-in-the-middle (MITM) attacks can be used to break 2FA systems that rely on one-time passwords. However, the U.S. National Institute of Standards and Technology (NIST) announced plans to deprecate the use of SMS for 2FA and one-time passwords, as the method is vulnerable to an assortment of attacks that could compromise those passwords and codes. As a result, enterprises considering deployment of one-time passwords should explore other delivery methods besides SMS.

Benefits of a one-time password

The one-time password avoids common pitfalls that IT administrators and security managers face with password security. They do not have to worry about composition rules, known-bad and weak passwords, sharing of credentials or reuse of the same password on multiple accounts and systems.

Another advantage of one-time passwords is that they become invalid in minutes, which prevents attackers from obtaining the secret codes and reusing them.