Reputation: 1728
I am sending users a 10 digit numbers and letters code through text as a method of 2FA. My use case is a bit different -- not your typical login 2FA code, but rather a passcode that can be used to unlock an encrypted document. This is why my codes need to be longer than just a few digits.
I'm looking for it to be easily copyable by users -- sometimes iPhone makes it so you can click a code in text and easily copy it. This appears on 6-digit numeric, but doesn't appear to be working for anything above 9 digits as far as I can tell.
Is there a set pattern that can tell iPhone that the code being sent is a verification code? Like a digit threshold or a format?
My current message looks something like this:
Thank you for signing up for XYZ. Your verification code is: JWtCtWJmD2g
I am also thinking about just sending just the code (with no description) or sending two messages -- an introduction and then the code on separate lines.
Upvotes: 2
Views: 1746
Reputation: 1728
As of February 2020, there appears to be no standardized format for SMS 2FA codes. There is currently a proposal from an engineer at Apple to create a unified format for SMS delivery.
I have found that iPhone is good at picking up "Here is your code: _____" regardless of how many digits / alphanumeric as long as:
Update: Oct 2020: I can now auto copy with 10 or fewer (was 9 or fewer before)
Upvotes: 2
Reputation: 1750
The standard mentioned above was announced by Apple on August 4th. You can now specify a custom code and domain using the following format:
747723 is your ExampleCo authentication code.
@example.com #747723
The first line is freeform text. The second line specifies the domain for which the code is valid and then provides the code after the #
.
You can also add autocomplete=one-time-code
to the form field that is expecting the 2FA code.
Upvotes: 1