Standards/otpauth-uri
otpauth URI
Overview
The otpauth URI (otpauth://TYPE/LABEL?PARAMETERS) carries the shared secret and settings of a one-time-password credential so that an authenticator app can enrol an account by scanning a QR Code 1. TYPE is totp (time-based, RFC 6238) or hotp (counter-based, RFC 4226), and the one required parameter is the Base32-encoded secret 11213. The format comes from Google Authenticator. Its definition is still a wiki page in Google's archived GitHub repository, and that page's history shows edits by a range of GitHub contributors 1228. The scheme is registered with IANA only as provisional, and two competing individual Internet-Drafts were trying to standardise it in November 2026; neither is an RFC 678. The canonical example, also the playground's default secret, is:
otpauth://totp/Example:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
History
Google Code, 2010. Google released Google Authenticator in 2010 as a free way for sites to add "something you have" two-factor authentication 5. The earliest archived copy of the format page, "KeyUriFormat" on the project's Google Code site, was captured on 24 September 2010 and shows a last edit of 2 April 2010 3. That version already had the otpauth://TYPE/LABEL?PARAMETERS shape, the hotp/totp types, the JBSWY3DPEHPK3PXP example key and the algorithm, digits, counter and period parameters. It had no issuer: its example was otpauth://totp/alice@google.com?secret=JBSWY3DPEHPK3PXP, and the label was "an URI authority" such as Alice or google.com 3. It listed MD5 as a fourth algorithm and said the algorithm, digits and period parameters were all ignored by Google Authenticator 3.
Issuer, 2013. A revision dated 5 June 2013 added the issuer. The label became an account name with an optional issuer prefix, "to prevent collisions between different accounts with different providers", and a new issuer parameter was "STRONGLY RECOMMENDED" 4. The two are still recommended together today, because older Google Authenticator versions ignore the parameter and use only the prefix 1.
GitHub wiki, 2014 onwards. On 9 October 2014 the wiki pages were migrated from code.google.com to GitHub; the page's history then shows edits by outside contributors 2:
| Date | Change |
|---|---|
| 4 May 2015 | MD5 removed: HOTP's dynamic truncation needs a digest of at least 20 bytes, and MD5's is 16 |
| 16 Oct 2015 | Label example changed to show @ URI-encoded as %40 |
| 3 Nov 2015 | Full example with all optional parameters added |
| 4 May 2017 | Secret padding to be omitted: Android Authenticator accepted = padding, iOS did not |
| 26 Nov 2018 | digits note narrowed: ignored on Android and BlackBerry, not on iPhone |
The GitHub repository that hosts the wiki is archived; its last push was on 28 September 2020 28.
Registration and drafts. IANA registered otpauth as a provisional URI scheme on 14 May 2020. The registration names Google Authenticator and Microsoft Authenticator as users and points to the Google wiki as the reference 6. In May 2022 Terence Eden described the result: a provisional registration but "no spec", with Google, Yubico, IIJ and IBM each documenting subtly different parameter sets 9. İlteriş Yağıztegin Eroğlu then submitted draft-linuxgemini-otpauth-uri: revision 00 on 9 November 2023, 01 in May 2024, 02 in February 2025 and 03 on 24 August 2026. The draft says it grew out of Eden's Fediverse post 7. A second draft, A. Escobar's draft-andesco-otpauth-uri, followed: revision 00 on 19 February 2026 and 01 on 30 October 2026 8.
Technical specification
Grammar. Google's wiki gives otpauth://TYPE/LABEL?PARAMETERS and, for the label, the ABNF 1:
label = accountname / issuer (":" / "%3A") *"%20" accountname
The account name is "a URI-encoded string". Issuer and account are separated by a literal or percent-encoded colon, optionally followed by encoded spaces, and "neither issuer nor account name may themselves contain a colon" 1. The wiki's valid examples are Example:alice@gmail.com, Provider1:Alice%20Smith and Big%20Corporation%3A%20alice%40bigco.com. It writes @ both literally and as %40 1.
Parameters (Google wiki unless noted) 1:
| Parameter | Status | Values / default | Notes |
|---|---|---|---|
secret |
Required | Base32 (wiki cites RFC 3548) | Padding "is not required and should be omitted" |
issuer |
Strongly recommended | URL-encoded per RFC 3986 | Should equal the label prefix when both are present |
algorithm |
Optional | SHA1 (default), SHA256, SHA512 |
"Currently ... ignored by the Google Authenticator implementations" |
digits |
Optional | 6 (default) or 8 |
Ignored by Google Authenticator on Android and BlackBerry |
counter |
Required if hotp |
integer | Sets the initial counter value |
period |
Optional, totp only |
seconds, default 30 |
Ignored by Google Authenticator |
Secret. RFC 3548 was obsoleted by RFC 4648 in October 2006. Base32 encodes 5 bits per character in the alphabet A–Z, 2–7, and padding may be omitted where the length is known 14. The example key JBSWY3DPEHPK3PXP is 16 characters, so 80 bits. The wiki gives its value as the bytes 'H','e','l','l','o','!',0xDE,0xAD,0xBE,0xEF 1. That is shorter than HOTP's own rule: RFC 4226 requirement R6 says the shared secret "MUST be at least 128 bits" and recommends 160 12. Apple asks for at least 160 bits 10.
Algorithms behind the types. HOTP is HMAC-SHA-1 over an 8-byte counter, truncated to a 6–8-digit decimal code 12. TOTP is HOTP with the counter replaced by T = floor((Unix time − T0) / X), with T0 = 0 and X = 30 s by default. TOTP implementations "MAY use HMAC-SHA-256 or HMAC-SHA-512" 13. The URI's period is X, and its counter is HOTP's starting counter.
Where the documents disagree.
| Point | Google wiki 1 | Apple 10 | Yubico 15 | linuxgemini-03 7 | andesco-01 8 |
|---|---|---|---|---|---|
digits |
6, 8 | 6, 8 | 6, 7, 8 | 6–8 | 6, 7, 8 (6 or 8 advised) |
period |
any, default 30 | default 30 | 15, 30, 60 | any, default 30 | integer > 0 |
| Issuer in label | recommended with the parameter | name of the service, then a colon | Issuer:Account |
parameter only | allowed, for display |
issuer value |
equals the label prefix | domain of the site or app | equals the label prefix | free text | domain recommended; authoritative for matching |
| Minimum secret | none | 160 bits ("should") | — | — | 128 bits (MUST), 160 (SHOULD) |
The andesco draft also says a consumer MUST reject a URI with a duplicated parameter, a missing secret, a decoded colon inside the issuer or account, a non-positive period, or an hotp counter outside 0 to 2^64 − 1. It defines & inside values as %26 8. Eden's 2022 survey adds IIJ's icon parameter and MD5 algorithm, and IBM's digits range of 6–9 9.
Extensions in the wild. KeePassXC reads and writes an encoder=steam parameter for Steam Guard codes, which use 5 characters from a 26-character alphabet instead of decimal digits 18.
Size. The playground's default payload, otpauth://totp/Example:alice@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example, is 79 characters. The playground renders it as a QR Code at error-correction level M, which is also BWIPP's default eclevel 24.
Use cases
- Website and app 2FA enrolment. The site shows a QR code; the authenticator app scans it and then generates codes offline. Apple's iPhone guide describes this flow, and the manual "setup key" fallback, for the built-in Passwords app 11. PyOTP's README shows the same: its server-side library produces the
otpauth://URI to be rendered as a QR code 16. - Password managers. Apple's iCloud Keychain accepts the URL under its own scheme,
apple-otpauth:, from a link on a web page or in an app; the system then asks the user which saved credential to attach it to 10. KeePassXC stores TOTP settings as an otpauth URL. Its importers convert entries from Bitwarden, Proton Pass and 1Password exports into otpauth URLs 18. - Server logins. Google's PAM module, which adds TOTP to Linux logins, builds an
otpauth://URL for the account and prints it as a QR code when libqrencode is available 22. - Hardware tokens. Yubico's SDK documents the otpauth URI as the input for loading OATH credentials onto a YubiKey 15.
- Enterprise identity. Microsoft Authenticator is named in the IANA registration 6. Microsoft Entra ID supports OATH TOTP software tokens but not HOTP 27.
- Device migration. Google Authenticator's transfer feature shows a QR code on the old phone to scan with the new one 23. That QR code holds an
otpauth-migration://offline?data=…link, not an otpauth URI. Itsdatais a protocol-buffer batch of credentials, and the open-source decoder dim13/otpauth converts it back into plain otpauth links 2021. No public Google document definingotpauth-migrationwas found; the schema in 21 is the decoder project's.
Implementations
Encoders and parsers.
- PyOTP (Python):
provisioning_uri()builds the URI andpyotp.parse_uri()reads it 16. PyOTP percent-encodes both the issuer prefix and the@(Secure%20App:alice%40google.com); Google's own example leaves@literal. Both are valid label forms 116. - otpauth by hectorm (JavaScript, also for Deno and Bun):
OTPAuth.URI.stringify()andOTPAuth.URI.parse(). Its stringified example always writesalgorithm,digitsandperiod17. - speakeasy (Node.js) describes itself as "NOT MAINTAINED" 26.
- KeePassXC (C++): parses
secret,digits,period,encoderandalgorithm, and writesotpauth://totp/<title>:<username>?secret=…&period=…&digits=…&issuer=…18. - google-authenticator-libpam (C): generates the URI 22.
- dim13/otpauth (Go): decodes
otpauth-migrationlinks, and can also re-encode them 20.
QR decoding. Any QR reader returns the URI as text. ZXing parses it as a generic URI result. Its Android app lists otpauth: as a "secure protocol": such URIs "will not be saved to history or copied to the clipboard for security" 19. No general barcode library checked here parses the otpauth fields itself; that happens in the authenticator or OTP library.
Renderer. The playground builds the string with Barcoder's otpauth-uri encoder and renders it with bwip-js, the JavaScript port of BWIPP, as symbology qrcode with eclevel M. BWIPP's QR options are eclevel L, M (default), Q and H 2425.
Comparison
- otpauth URI vs typing the setup key. Both carry the same Base32 secret. Apple offers manual entry as the fallback when a QR code cannot be scanned 11. A typed key carries no issuer, account, algorithm, digits or period, so the app falls back to its defaults; the URI carries all of them 1.
otpauth:vsapple-otpauth:. Apple's scheme is "identical to the standard" but uses a different scheme name, so that a link can target iCloud Keychain directly 10. Apple'sissueris a domain, used to suggest the matching credential; Google's is a display name equal to the label prefix 110.- otpauth vs otpauth-migration. An otpauth URI provisions one credential from a service. The Google migration link carries a batch of already-provisioned credentials between two copies of Google Authenticator 202123.
- TOTP vs HOTP.
totpcodes change everyperiodseconds and depend on both clocks agreeing.hotpcodes advance per use, so the URI must carry the startingcounter113. Since 2023 Google Authenticator can also back codes up to the user's Google Account instead of keeping them on one device 5.
Fun facts
- The format's best-known secret is a joke:
JBSWY3DPEHPK3PXPdecodes to "Hello!" followed by the bytesDE AD BE EF1. - The de facto definition of a credential format is a GitHub wiki page edited through ordinary wiki commits: the 2015 removal of MD5 and the 2017 padding rule both arrived that way, each with a one-line explanation in its commit message 2.
Status
In use, not standardised. The otpauth URI is the format websites, password managers, PAM modules and hardware-token SDKs use for TOTP/HOTP enrolment 11015161822. Its reference is a wiki in an archived repository last pushed in 2020, and the IANA registration is provisional 628. On 9 November 2026 both Internet-Drafts were active, as individual submissions with no IESG processing ("I-D Exists"). draft-linuxgemini-otpauth-uri-03 expires on 25 February 2027 and draft-andesco-otpauth-uri-01 on 3 May 2027. Each asks IANA to point the provisional registration at itself if it is published as an RFC 78.
Sources
Deployments
No country reports mention this standard by name.
Regions / aggregations not mapped to a single country
- Universal