> ## Documentation Index
> Fetch the complete documentation index at: https://docs.theblockchainlibrary.com/llms.txt
> Use this file to discover all available pages before exploring further.

# One-Time Password

> A One-Time Password (OTP) is an automatically generated numeric or alphanumeric string that authenticates a user for a single transaction or login session. Unlike static passwords, which are vulnerable to replay attacks, OTPs expire after a short period or a single use. They are 

# One-Time Password

A One-Time Password (OTP) is an automatically generated numeric or alphanumeric string that authenticates a user for a single transaction or login session. Unlike static passwords, which are vulnerable to replay attacks, OTPs expire after a short period or a single use. They are commonly implemented via Time-based One-Time Password (TOTP) algorithms, which synchronize a shared secret and the current time between a server and an authentication application to produce a temporary code.

## Definition

A One-Time Password (OTP) is an automatically generated numeric or alphanumeric string that authenticates a user for a single transaction or login session. Unlike static passwords, which are vulnerable to replay attacks, OTPs expire after a short period or a single use. They are commonly implemented via Time-based One-Time Password (TOTP) algorithms, which synchronize a shared secret and the current time between a server and an authentication application to produce a temporary code.

## Simple explanation

An OTP is like a temporary access code that only works for a few seconds. Even if a hacker steals the code after you use it, it will be useless by then. It provides an extra layer of security, so even if someone knows your password, they can't get in without your unique temporary code.

## Why it matters

OTP is a critical secondary defense layer for crypto exchanges and platforms. It helps mitigate the risk of account takeovers caused by credential stuffing or stolen passwords in the Web3 ecosystem.

## How it works

The server and the user's app both hold a secret key and the current time. Using a HMAC-based algorithm (TOTP), both sides calculate a numeric code based on these inputs. Because the time is synced, both sides generate the same code, which the user then enters to prove they possess the device holding the secret key.

## Real-world example

Google Authenticator and Authy apps generate standard TOTP codes used by exchanges like Binance and Coinbase.

## Advantages

* Protects against static password theft
* Easy to implement
* Temporary and limited use

## Limitations

* Vulnerable to phishing attacks
* Device loss creates recovery issues
* Sync issues between client and server

## Common misconceptions

* Many users believe receiving an OTP via SMS is secure, but it is actually vulnerable to SIM swapping attacks.
* People assume that having an OTP means they don't need a strong primary password.

## Related knowledge

* [Authentication](https://docs.theblockchainlibrary.com/generated/v2/glossary/authentication) — term
* [Security](https://docs.theblockchainlibrary.com/categories/security) — term
* [TOTP](https://docs.theblockchainlibrary.com/generated/v2/glossary/totp) — term
* [Two-Factor Authentication](https://docs.theblockchainlibrary.com/generated/v2/glossary/two-factor-authentication) — term

***

**Canonical knowledge ID:** `glossary:one-time-password`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.