What is a Time-based One-time Password (TOTP)? (2024)

TOTP stands for Time-based One-Time Passwords and is a common form of two-factor authentication (2FA). Unique numeric passwords are generated with a standardized algorithm that uses the current time as an input. The time-based passwords are available offline and provide user-friendly, increased account security when used as a second factor.

What is a Time-based One-time Password (TOTP)? (1)

Example TOTP accounts in an authenticator app

TOTP is also known as app based authentication, software tokens, or soft tokens. Authentication apps like Authy and Google Authenticator support the TOTP standard.

Twilio's Verify API offers support for TOTP authentication in addition to SMS, voice(link takes you to an external page), email, and push channels. Get started with our TOTP sample application(link takes you to an external page) or step-by-step QuickStart.

One-time passwords for two factor authentication

one-time-passwords-for-two-factor-authentication page anchor

2FA adds an extra layer of account protection by requiring two types of authentication. This can be something a user knows, like a password, and something the user has, like a phone. One-time passwords, including TOTP, are a common possession or "something you have" factor and help increase the security of your users accounts.

A recent study about the usability of 2FA methods found that TOTP had the highest usability score of the various second factors tested. This tells us that TOTP is not only a viable method for authentication, but will be preferred by many users.

What is a Time-based One-time Password (TOTP)? (2)

system usability scale (SUS) scores show TOTP is most usable

The TOTP algorithm

the-totp-algorithm page anchor

The TOTP algorithm follows an open standard documented in RFC 6238. The inputs include a shared secret key and the system time. The diagram below shows how the two parties can separately calculate the passcode without internet connectivity.

What is a Time-based One-time Password (TOTP)? (3)

The algorithm uses a form of symmetric key cryptography: the same key is used by both parties to generate and validate the token.

TOTP works offline

totp-works-offline page anchor

The inputs to the TOTP algorithm are device time and a stored secret key. Neither the inputs nor the calculation require internet connectivity to generate or verify a token. Therefore a user can access TOTP via an app like Authy while offline.

TOTP's offline support is ideal for users who might need to access their authentication while traveling abroad, on a plane, in a remote area, or otherwise without network connectivity.

TOTP 2FA vs. SMS 2FA

totp-2fa-vs-sms-2fa page anchor

While SMS is an ideal solution for 2FA adoption(link takes you to an external page) and ease of use, TOTP has several benefits including:

  • Offline support
  • PII-less registration
  • Standardized authentication solution
  • Software based, not dependent on carrier fees or telephony access and deliverability
  • Faster average time to authenticate
  • Increased security compared to SMS 2FA: the secret key input for TOTP is only shared once and the method does not rely on the telephony network, which helps reduce the attack surface. TOTP has stronger proof of possession than SMS, which can be legitimately accessed via multiple devices and may be susceptible to SIM swap attacks.

Most customers end up implementing multiple forms of 2FA, so their users can choose the channel that works best for them. Other channels Twilio Verify supports include push, voice, and email. This blog post(link takes you to an external page) takes a more detailed look at the security concerns of SMS 2FA.

HOTP vs. TOTP

hotp-vs-totp page anchor

HOTP stands for HMAC-based One-Time Password and is the original standard that TOTP was based on. Both methods use a secret key as one of the inputs, but while TOTP uses the system time for the other input, HOTP uses a counter, which increments with each new validation. With HOTP, both parties increment the counter and use that to compute the one-time password.

The HOTP standard is documented in RFC 4226.

While HOTP is still used, consumer authenticator apps like Authy and Google Authenticator implement the TOTP standard.

Get started with TOTP

get-started-with-totp page anchor

Add TOTP authentication support with the Twilio Verify API

add-totp-authentication-support-with-the-twilio-verify-api page anchor

Here's the code to create a TOTP factor. Follow the TOTP Quickstart for more details about how to generate a QR code and validate tokens.

Create a new TOTP factor

Link to code sample: Create a new TOTP factor

1

// Download the helper library from https://www.twilio.com/docs/node/install

2

const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

3

5

// and set the environment variables. See http://twil.io/secure

6

const accountSid = process.env.TWILIO_ACCOUNT_SID;

7

const authToken = process.env.TWILIO_AUTH_TOKEN;

8

const client = twilio(accountSid, authToken);

9

10

async function createNewFactor() {

11

const newFactor = await client.verify.v2

12

.services("VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")

13

.entities("ff483d1ff591898a9942916050d2ca3f")

14

.newFactors.create({

15

factorType: "totp",

16

friendlyName: "Taylor's Account Name",

17

});

18

19

console.log(newFactor.binding);

21

22

createNewFactor();

Output

1

{

2

"sid": "YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",

3

"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",

4

"service_sid": "VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",

5

"entity_sid": "YEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",

6

"identity": "ff483d1ff591898a9942916050d2ca3f",

7

"binding": {

8

"alg": "ES256",

9

"public_key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8GdwtibWe0kpgsFl6xPQBwhtwUEyeJkeozFmi2jiJDzxFSMwVy3kVR1h/dPVYOfgkC0EkfBRJ0J/6xW47FD5vA=="

10

},

11

"date_created": "2015-07-30T20:00:00Z",

12

"date_updated": "2015-07-30T20:00:00Z",

13

"friendly_name": "Taylor's Account Name",

14

"status": "unverified",

15

"factor_type": "totp",

16

"config": {

17

"sdk_version": "1.0",

18

"app_id": "com.example.myapp",

19

"notification_platform": "fcm",

20

"notification_token": "test_token"

21

},

22

"metadata": {

23

"os": "Android"

24

},

25

"url": "https://verify.twilio.com/v2/Services/VAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Entities/ff483d1ff591898a9942916050d2ca3f/Factors/YFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

26

}

TOTP in the Authy App

totp-in-the-authy-app page anchor

Here is an example of a TOTP generated with the Verify API inside the Authy App. Tokens expire in 30 seconds by default, but you can change the expiration period when you create a Factor.

What is a Time-based One-time Password (TOTP)? (4)

How to protect your accounts with an authenticator app

how-to-protect-your-accounts-with-an-authenticator-app page anchor

Download the Authy app for iOS or Android and learn more about how to add authenticator app support on your favorite websites with Authy's 2FA guides.

Next steps with TOTP

next-steps-with-totp page anchor

TOTP support through a consumer authenticator app is widely available, PII-less, and offers increased security. TOTP is a great solution for both providing a good user experience and strong authentication. Many companies now offer TOTP support as a step up from SMS based 2FA.

Check out these resources for more information on Twilio's APIs for multichannel user verification:

  • Verify TOTP Quickstart
  • Verify API reference
  • Verify customers(link takes you to an external page)
  • Verify pricing(link takes you to an external page)
What is a Time-based One-time Password (TOTP)? (2024)
Top Articles
How To Write an Employment Verification Letter
The 11 Best Alternative Investments in 2024
Mate Me If You May Sapir Englard Pdf
Craigslist Mpls Mn Apartments
Exam With A Social Studies Section Crossword
Meer klaarheid bij toewijzing rechter
Craigslist Parsippany Nj Rooms For Rent
Tap Tap Run Coupon Codes
41 annonces BMW Z3 occasion - ParuVendu.fr
414-290-5379
Ktbs Payroll Login
Azeroth Pilot Reloaded - Addons - World of Warcraft
Qhc Learning
New Mexico Craigslist Cars And Trucks - By Owner
Hartford Healthcare Employee Tools
Blog:Vyond-styled rants -- List of nicknames (blog edition) (TouhouWonder version)
Mens Standard 7 Inch Printed Chappy Swim Trunks, Sardines Peachy
Https://Store-Kronos.kohls.com/Wfc
Bitlife Tyrone's
Immortal Ink Waxahachie
Beebe Portal Athena
Roll Out Gutter Extensions Lowe's
Richland Ecampus
Fort Mccoy Fire Map
Veracross Login Bishop Lynch
Ups Drop Off Newton Ks
Yisd Home Access Center
Japanese Mushrooms: 10 Popular Varieties and Simple Recipes - Japan Travel Guide MATCHA
Shreveport City Warrants Lookup
City Of Durham Recycling Schedule
January 8 Jesus Calling
Enduring Word John 15
Gt7 Roadster Shop Rampage Engine Swap
Missing 2023 Showtimes Near Mjr Southgate
Wake County Court Records | NorthCarolinaCourtRecords.us
Pnc Bank Routing Number Cincinnati
Darrell Waltrip Off Road Center
Junior / medior handhaver openbare ruimte (BOA) - Gemeente Leiden
Colorado Parks And Wildlife Reissue List
Ursula Creed Datasheet
5A Division 1 Playoff Bracket
Honkai Star Rail Aha Stuffed Toy
Bmp 202 Blue Round Pill
3500 Orchard Place
News & Events | Pi Recordings
New Starfield Deep-Dive Reveals How Shattered Space DLC Will Finally Fix The Game's Biggest Combat Flaw
Premiumbukkake Tour
Best Restaurant In Glendale Az
Minute Clinic Mooresville Nc
Fresno Craglist
Dcuo Wiki
Latest Posts
Article information

Author: Jonah Leffler

Last Updated:

Views: 6230

Rating: 4.4 / 5 (65 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Jonah Leffler

Birthday: 1997-10-27

Address: 8987 Kieth Ports, Luettgenland, CT 54657-9808

Phone: +2611128251586

Job: Mining Supervisor

Hobby: Worldbuilding, Electronics, Amateur radio, Skiing, Cycling, Jogging, Taxidermy

Introduction: My name is Jonah Leffler, I am a determined, faithful, outstanding, inexpensive, cheerful, determined, smiling person who loves writing and wants to share my knowledge and understanding with you.