coderef

WebOTPLimited availability

The OTPCredential API represents a one-time-password (OTP).

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–92Not supported
93+Supportedsince Aug 31, 2021
Current: 155
Edge
12–92Not supported
93+Supportedsince Sep 2, 2021
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
1–26.6Not supported
27+Supportedsince Sep 14, 2026
Current: 27
MobileChrome Android
18–83Not supported
84+Supportedsince Jul 27, 2020
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
1–26.6Not supported
27+Supportedsince Sep 14, 2026
Current: 27

How to use

Not supported in Firefox, Firefox Android. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: OTPCredential.

Feature detection

JS · check before using
if ("OTPCredential" in globalThis) {
  // OTPCredential is available
} else {
  // load a polyfill or use a fallback
}

Sub-features

Support for each part of the feature (5). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
CredentialsContainer.get.otp_option9393✕2784✕27
OTPCredential9393✕✕84✕✕
OTPCredential.code9393✕✕84✕✕
iframe.allow.otp-credentials9393✕✕84✕✕
http.headers.Permissions-Policy.otp-credentials9393✕✕88✕✕