| Internet-Draft | otp-token | September 2026 |
| Goto & West | Expires 22 March 2027 | [Page] |
This document defines the OTP-Token email header field, which can be used to deliver One-Time
Passcodes (OTP) in a machine-readable and origin-bound manner alongside the human-readable message
carrying that content today. Recipient Message User Agents (rMUA) can collaborate with other
entities in the ecosystem to assist in the delivery of these codes to the context which wishes to
verify their successful delivery.¶
This note is to be removed before publishing as an RFC.¶
The latest revision of this draft can be found at https://mikewest.github.io/otp-token/draft-goto-otp-token.html. Status information for this document may be found at https://datatracker.ietf.org/doc/draft-goto-otp-token/.¶
Source for this draft and an issue tracker can be found at https://github.com/mikewest/otp-token.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 22 March 2027.¶
Copyright (c) 2026 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
One-time passcodes delivered via email are widely used as part of flows which require verification of a user's contact information. Sign-in/-up flows, reauth for high-risk transactions, account recovery, and so on all might reasonably rely on verifying a user's access to a particular email address by sending a secret code to that address, and waiting for the user to prove that they know what code was sent by typing it into some other context.¶
Today, actions which require verification through email will begin in one context (say, a sign-in form on a website), but require users to hop to another context (their rMUA) to track down the relevant email after waiting for delivery, memorize a short code, and then hop back to the verifying context to type it in. This flow is frustrating, as context-switching leads to confusion and failure. It's also phishable, as users can be tricked into typing a code meant for a trusted context into an attacker-controlled site.¶
[SMS-ONE-TIME-CODES] showed that a machine-readable, origin-bound format for SMS-based OTPs can reduce both frustration and phishing by making it possible for software to easily extract OTPs and feed them into systems like [WEBOTP] or a platform's autofill mechanism. This approach can dramatically reduce the friction users experience, only in those cases where the context into which the code is delivered can be verified to be the destination to which the code has asserted a binding. This doesn't prevent phishing as users can still be tricked into typing the code manually, but it's a substantial improvement in the system's general security posture.¶
Learning from that experience, this document proposes two things: first, we can extend the core concept of a standardized delivery format from SMS to email, taking advantage of email's distinction between headers and user-visible content to do so. Second, we suggest that the header can carry information that's supplemental to the short OTP meant for human consumption, and that such information might create additional opportunities to improve the entire system's robustness.¶
It's important to note, however, that these proposals address only one piece of a larger system,
allowing automated extraction of OTPs, but leaving important, platform-specific details of their
integration with the rest of the system out of scope. Those mechanisms will be defined elsewhere
(e.g. HTML defines <input autocomplete="one-time-code">, iOS defines NSTextInput with
.oneTimeCode, and so on).¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
This document relies on [RFC5598] to define Recpient Mail User Agents (rMUA) and other aspects of email infrastructure.¶
This document further relies on Section 3 of [STRUCTURED-FIELDS] to define a number of concepts
around parsing and syntax, including: String, Byte Sequence, Parameters, and the sf-item ABNF
rule.¶
This document relies on [RFC6454] for the definition of an origin, and on Section 6.2 of that
document for its ASCII serialization. The serialized-origin grammar is defined in Section 7.1.¶
A One-Time Passcode is a tuple consisting of:¶
OTP-Token Header Field
The OTP-Token header field delivers an origin-bound OTP, optionally including a high-entropy
token. For example:¶
OTP-Token: "123456"; origin="https://example.com"; token=:NjU0MzIx:¶
This header is a Structured Field containing a String (Section 3.3.3 of [STRUCTURED-FIELDS]) representing the OTP, along with with Parameters (Section 3.1.2 of [STRUCTURED-FIELDS]) representing the origin to which the OTP is bound, and an optional high-entropy token.¶
OTP-Token MUST appear at most once in a message's header section. Instances appearing in the
header sections of MIME body parts MUST be ignored.¶
Note that headers including a token Parameter are likely to exceed the 998/78 character
limitations specified in Section 2.2.3 of [RFC5322], and will be folded accordingly. Section 3.2
specifies how that common case is to be handled.¶
The OTP-Token header MUST contain an origin Parameter, and MAY contain a token Parameter:¶
origin: This parameter represents the origin to which the OTP is bound. Its value is a String
containing the ASCII serialization of an origin conforming to Section 6.2 of [RFC6454]. This
value MUST not be the serialization of an opaque origin ("null"), MUST be a potentially
trustworthy origin as defined in [SECURE-CONTEXTS], and MUST be in canonical form (lowercase,
default ports omitted, ASCII-only).¶
Note: [RFC6454] and [URL]/[HTML] do not entirely agree on origins or their serialization. The constraints above keep them more or less aligned for the subset of origins this document permits; reconciliation beyond that is well outside this document's scope.¶
token: This parameter represents a validation token associated with the OTP that's meant for
automated systems rather than human interaction. Its value is a Byte Sequence .¶
Unknown Parameters are ignored in order to make future expansion possible if necessary.¶
The following algorithm describes the process of parsing and validating the OTP-Token header into
an One-Time Passcode object, given a message and receipt-timestamp. Parsing fails if no valid
OTP is available:¶
If message's header section contains zero or more than one OTP-Token header, fail.¶
Let value be the result of unfolding message's header section's OTP-Token header as
specified in Section 2.2.3 of [RFC5322].¶
Let parsed be the result of parsing value as specified in Section 4.2 of
[STRUCTURED-FIELDS], with a field_type of "item". If parsing value as a Structured Field
fails, fail.¶
If parsed's bare_item is not a String, fail.¶
If parsed's parameters contains no item whose key is "origin", fail.¶
Let origin be the value of parsed's parameters' item whose key is "origin".¶
Fail if any of the following conditions are true:¶
Let token be null.¶
If parsed's parameters contains an item whose key is "token":¶
Return a new One-Time Passcode whose:¶
Note: [STRUCTURED-FIELDS] has no concept of header folding. The ordering of steps 2 and 3 above is therefore necessary to enable proper parsing of message headers.¶
TODO. Probably something about DKIM?¶
token Availability?
The token value is a bearer token. Its usefulness rests entirely upon its general invisibility to
humans, meaning that a user tricked into inputing an OTP will not be able to easily hand it over.¶
While this seems accurate, it is not impossible to overcome. Users could be socially engineered into
accessing the message headers via an rMUA's "show original" affordance. Or they could be convinced
to forward the email to an attacker, headers and all. Likewise, the token is only as secure as the
mailbox itself.¶
In short, token can raise the bar for an attacker, but it does not absolutely prevent phishing.¶
Authentication mechanisms like federation and [WEBAUTHN] are clearly the directions in which the ecosystem should move. Improvements to OTP delivery are not arguments in the other direction. Still, it's important to recognize that email verification often serves as a last-resort fallback mechanism for account recovery. This document's proposal aims only to create low-cost opportunities to mitigate some of that validation path's inherent risks.¶
TODO: Say something here about identifying the initiating context's origin and how it'll all be platform-specific.¶
IANA is asked to update the Provisional Message Header Field Names registry [RFC3864] with the following entry:¶
Is specifying a single origin enough? Do we need scoping rules to tie OTPs to multiple
origins? Sites rather than origins?¶
Rather than relying on the relying party to examine the received timestamp, should we offer a
ttl/expires Parameter after which the automated system would refuse to offer the OTP?¶
Should we try to create tighter checks for the OTP's specified origin? That is, should we only accept origin bindings that can be authenticated via DKIM/DMARC?¶
And, of course, we should bikeshed the naming. OTP-Token, One-Time-Passcode,
Super-Secret-Thing-That-Humans-Should-Not-Read, etc.¶
This can be considered an email-based implementation of [SMS-ONE-TIME-CODES], which paved the way to formalizing a machine-readable format for these short-lived verification codes.¶