liveBook · Manning

One-time code

As explained in Architecting Accessibility

A one-time code is a temporary code intended to be used once, commonly as part of an identity-verification process.

A one-time code is a temporary verification code, often sent by SMS. Moving it from a phone to a laptop requires users to perceive, remember, and retype it—a task that can create barriers for people with cognitive or learning disabilities. Browser assistance can reduce that effort and transcription errors. section 7.4.2

Set the code field’s autocomplete attribute to one-time-code. Supported browsers can recognize specially formatted SMS messages and help enter the code. The message identifies the intended website so the browser can check that it matches the site requesting the code, helping reduce misdirected submissions. section 7.4.2

<input 
  required 
  type="text" #A
  id="otc" 
  name="otc"
  autocomplete="one-time-code" #B
  inputmode="numeric" #C
  maxlength="6" 
/> 

Example six-digit code field with autocomplete enabled; numeric input mode and a length limit suit this example. section 7.4.2

Your BarkBank verification code is 324532. #A
@barkbank.com #324532 #B

Example SMS associates a verification code with the barkbank.com domain for browser assistance. section 7.4.2

An SMS code can act as the “something you have” factor in two-factor authentication. But SMS can be vulnerable to phishing and depends on mobile-network access; consider whether users can access and transfer the code easily. section 7.4.2 section 7.6

How Architecting Accessibility covers it

How deep it goes
Explains autocomplete, origin matching, and SMS limitations, while describing browser assistance as limited.
Examples
Uses a six-digit phone-to-laptop login and a BarkBank SMS example.
What you can do after
Apply the autocomplete="one-time-code" attribute and use the specified SMS format to enable browser assistance.
How it connects
Links one-time codes to SMS, browser autocomplete, transcription, and two-factor authentication.

Also explained in

Compare how 4 books explain one-time code →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.