WebOTP (one time code from SMS)
Lets a page read the one time code from an SMS the person receives.
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
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 93 | 2021-08-31 | None |
| Edge | Supported | 93 | 2021-09-02 | None |
| Firefox | Not supported | Not available | Not listed | None |
| Safari | Not supported | Not available | Not listed | Safari 27 has otp_option member; OTPCredential absent |
| Safari on iPhone | Not supported | Not available | Not listed | Same as Safari |
| Chrome on Android | Supported | 84 | 2020-07-27 | None |
| Samsung Internet | Supported | 14.0 | 2021-04-17 | None |
How a site asks for it
| API | navigator.credentials.get({otp:{transport:['sms']}}) with SMS ending '@example.com #123456' |
| Permissions policy | otp-credentials |
| Browser compat keys | api.OTPCredential |
| How access is granted | prompt |
| What the user sees | Bottom sheet on Android to allow code sharing |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | Per origin |
| How to take it back | Site settings |
| Inside an iframe | Same as top level; cross-origin iframes need a permissions policy where listed |
Typical flow
- Call the API
- Browser applies its access rules
- 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
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
OTPCredential.code | string | None | 4 to 10 digits typical | one 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
| Type | Example | Apps |
|---|---|---|
| banking | You log in to a bank's web page, get a text, and the code fills in after one tap. | None named |
| payments | You 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 |
| shopping | A shopping site sends a code when you create an account. Chrome on Android offers to fill it, so signup takes seconds. | None named |
| rideshare | You open a ride booking site on your phone and verify your number. The code fills itself, so you get a car faster. | None named |
| social | A web social app verifies a new phone number during signup without making you leave the browser to read a text. | None named |
| security | A site uses it to make two step sign in easier, which makes people more willing to turn it on. | None named |
| games | A 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
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 4 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 2 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough 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.