Skip to Content
Platform.Ontology

WebOTP (one time code from SMS)

Lets a page read the one time code from an SMS the person receives.

Asks you firstContacts and personal dataVerificationWeb browsersWhile you use it

In one line

Can see one text message code meant for that site, after you allow it

Lets a page read the one time code from an SMS the person receives.

Reads one matching SMS code that is tied to the site's domain; not the whole SMS inbox.

What it can and can't do

What the user does: You ask to log in or confirm a phone number, then tap Allow on the sheet

It can

  • Receive the one time code from a text message that names the site's web address
  • Fill in that code for you, so you do not type it
  • Ask again each time a new code arrives

It cannot

  • Open your other text messages
  • Receive a code from a message that does not name the site
  • Work on iPhone, Safari or Firefox
  • Keep watching for codes after you leave the page

How it differs between platforms: Works in Chrome, Edge and Samsung Internet on Android. Safari and Firefox do not support it; iPhone shows the code as a keyboard suggestion instead.

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported932021-08-31None
EdgeSupported932021-09-02None
FirefoxNot supportedNot availableNot listedNone
SafariNot supportedNot availableNot listedSafari 27 has otp_option member; OTPCredential absent
Safari on iPhoneNot supportedNot availableNot listedSame as Safari
Chrome on AndroidSupported842020-07-27None
Samsung InternetSupported14.02021-04-17None

How a site asks for it

APInavigator.credentials.get({otp:{transport:['sms']}}) with SMS ending '@example.com #123456'
Permissions policyotp-credentials
Browser compat keysapi.OTPCredential
How access is grantedprompt
What the user seesBottom sheet on Android to allow code sharing
Needs a secure context (HTTPS)Yes
Needs a user gestureNo
How long it lastsPer origin
How to take it backSite settings
Inside an iframeSame as top level; cross-origin iframes need a permissions policy where listed

Typical flow

  1. Call the API
  2. Browser applies its access rules
  3. Page receives the result

Data you get

What comes back: Lets a page read the one time code from an SMS the person receives.
Shape: object
How often: on demand

FieldTypeUnitRangePrecision
OTPCredential.codestringNone4 to 10 digits typicalone message

Technical limits

  • SMS must contain a bound domain line
  • Only the first matching message
  • No desktop SMS without paired Android

The story

What it is

A page can read the six digit code from a text message so you do not have to type it.

For you

You get a text with a code. Your browser shows a small box asking if the site may use it. You tap Allow and the code drops into the form, so you skip copying digits.

For makers

Fewer people give up at sign in or payment. The text uses a special format that names the site's own domain, so only that site can read the code. This lifts sign up rates and cuts support calls.

Where you see it

TypeExampleApps
bankingYou log in to a bank's web page, get a text, and the code fills in after one tap.None named
paymentsYou pay online and the card bank texts a one time code. A checkout page reads it so you do not leave the page.None named
shoppingA shopping site sends a code when you create an account. Chrome on Android offers to fill it, so signup takes seconds.None named
rideshareYou open a ride booking site on your phone and verify your number. The code fills itself, so you get a car faster.None named
socialA web social app verifies a new phone number during signup without making you leave the browser to read a text.None named
securityA site uses it to make two step sign in easier, which makes people more willing to turn it on.None named
gamesA browser game with phone login lets you verify your number and get back to playing in one tap.None named

Risks

  • Texts can be hijacked by SIM swap
  • Only some browsers support it

What the platform says

  • Google Chrome: WebOTP API. Automatically fills the verification code from an SMS, so signing in on the web is faster.
  • MDN: WebOTP API. A way for a page to receive a one time password from a text message, with the person's consent.

Good uses and abuse

Legitimate uses

  • 2FA fill

Known abuse

  • Phishing sites without matched domain fail

Scores

ScoreValueMeaning
Sensitivity4 of 5How revealing the data is
Utility3 of 5How useful it is to honest apps
Friction2 of 5How much the user has to do
Fingerprint bitsNot ratedRough identifying entropy, when known

History

  • 2020-12, Chrome on Android 84: WebOTP ships on Chrome Android
  • 2021-08, Chrome 93: Desktop Chrome with Android phone as sync source
  • 2026-09, Safari 27: Safari 27 adds an otp_option member only

Sources

How well checked: Checked against real behavior.

On this page