NIST requires a binding code of at least 40 bits when it is used with an identifier entered in the previous step. That makes 40 bits a minimum, so a shorter code fails the rule in that case.
Everyday takeaways
- Treat 40 bits as the floor for any signup code tied to an identifier the person typed in the previous step.
- Map each later code send to one named endpoint so you can show where every code went.
- Keep pending codes in storage that guards against accidental disclosure and unauthorized access.
- Count failed code attempts on the server side, where the service can keep state between requests.
What the NIST rule says: at least 40 bits
The clearest number in NIST's guidance on this topic appears in NIST Special Publication 800-63B, which says: "The binding code SHALL be at least 40 bits in length if it is used with an identifier that was entered in the previous step."
That sentence has three parts that matter for a signup flow. The first is the figure itself. Forty bits is a lower limit, not a target. A code longer than 40 bits still meets the rule, but a shorter one does not. The second is the condition. The rule applies when the code is used with an identifier, and that identifier must have been entered in the previous step. On a typical signup form, it is the email address or phone number the person typed before the code screen appeared. The third is the word SHALL in the quoted rule, so a shorter code cannot be defended as close enough.
| Rule element | What the NIST text says |
|---|---|
| Minimum binding code length | 40 bits |
| Condition | An identifier was entered in the previous step |
| Strength of wording | SHALL, the word used in the quoted rule |
Bits are the right unit to check. Each added bit doubles the number of values a code can take, so a 40-bit code is far harder to guess than a short numeric one. The rule counts bits, not characters, so a team should convert its code format into bits before comparing it with the floor. A code that looks long on a screen can still fall short if its character set is small.
Worked example: checking a code length
For illustration, suppose a signup code is 25 bits long and the person's email address was entered in the previous step. The 40-bit floor applies, and 25 is below it, so the code fails the rule. The team changes the code to 50 bits. That meets the floor, because the rule sets a minimum and a longer code still passes.
Why binding replaces issuance in NIST's wording
NIST avoids the word "issuance" when it describes this step. The guidance states: "The SP 800-63 suite of guidelines refers to the binding rather than the issuance of authenticators to accommodate both options." The term is chosen to cover two situations in one vocabulary, and the table below sets them side by side on the same measures.
| Measure | Binding at enrollment | Binding through an approving endpoint |
|---|---|---|
| Where NIST places it | Enrollment process, with details in SP800-63A | Section 3.2.12 of SP800-63B |
| Where the code goes | Part of the enrollment process | The new authenticator endpoint or the authenticated endpoint approving the binding |
Read the table as a checklist. Each column names one option, and each row asks the same question of it. A team can then see which path its own flow follows. A code sent while an account is being created falls under the first column. A code that attaches a new method to an account the person already controls falls under the second. Both columns use the same binding vocabulary, which is the reason NIST chose that word over issuance. For the assurance levels behind these login choices, see NIST assurance levels for signup login methods.
Binding at enrollment or later
NIST's guidance on this point is direct: "Binding at the time of enrollment is considered to be part of the enrollment process and is discussed in [SP800-63A]." The source is the NIST Special Publication 800-63B page, which hands the enrollment details to a separate document.
For a growth team, this has a practical consequence. A code sent before the account opens sits at the time of enrollment, so NIST treats it as part of enrollment. That code should not be treated as a free-standing check. It belongs to the account-creation step, and the rules around it should be designed, reviewed, and tested as enrollment rules. Keep them separate from the code paths used when a person later changes their sign-in methods. Mixing the two makes it hard to say which rules applied to which account.
The timing question is simple to ask. When was the account created, and was the person already signed in when the code was sent? If the account was not yet open, the flow is enrollment. If the person was already signed in and approved a new binding, the flow is the approving-endpoint path described in section 3.2.12. Writing down that answer for each code send gives the team a clear record it can use in reviews and audits.
Sending the code to the right endpoint
NIST ties the sending step to section 3.2.12. The guidance says the code should be sent "to either the new authenticator endpoint or the authenticated endpoint approving the binding," as stated on the NIST Special Publication 800-63B page.
There are two destinations, and the wording makes the difference clear. The new authenticator endpoint is where the new method is registered. The authenticated endpoint approving the binding is where a person who is already signed in approves that method. For a binding after enrollment, a code goes to only one of these, so the first job is to decide which one applies.
Three steps make this concrete for a team:
- List every code send in the signup flow, plus any later change to sign-in methods.
- Label each send as enrollment (the account is being created) or approving-endpoint binding (a signed-in person adds a method), and record the endpoint next to each approving-endpoint send in your documentation.
- Test that a code issued for one endpoint is rejected when someone submits it to the other.
The third step catches codes that are accepted by the wrong endpoint. Without it, a code can travel to the right place on paper and still be accepted somewhere it should not be.
Limiting failed code attempts
NIST's rule for failed attempts is stated in section 3.2.2 of the NIST Special Publication 800-63B guidance: "3.2.2 requires the CSP or verifier to maintain state information on recent failed authentication attempts, except for activation factors verified at the authenticator." The rule names the CSP or verifier, and for a signup code the verifier is the system that checks it.
| Item | What NIST says |
|---|---|
| Who maintains state | The CSP or verifier |
| What is kept | State information on recent failed authentication attempts |
| Exception | Activation factors verified at the authenticator |
"Maintain state" means the service must remember recent failures between requests. The count cannot live only in a page that a person can reload or reset. It has to sit in a record the service controls, tied to the account or request being checked. The exception covers activation factors verified at the authenticator, meaning the check happens on the device or key itself rather than on your server. For a signup code checked by your service, the server-side record is the relevant one. Design the flow so that a failed code is counted there, every time.
Keeping pending codes in secure storage
A pending code is a secret that waits in storage until the person enters it. OWASP's guidance on session management addresses a similar problem for session IDs, and its wording applies the same logic to pending codes: "The storage capabilities or repository used by the session management mechanism to temporarily save the session IDs must be secure, protecting the session IDs against local or remote accidental disclosure or unauthorized access." The quote comes from the OWASP Session Management Cheat Sheet. For related session identifier guidance, see session ID length rules.
| Element | What OWASP says |
|---|---|
| Requirement | The storage must be secure |
| First threat it guards against | Local or remote accidental disclosure |
| Second threat it guards against | Unauthorized access |
The sentence is written about session IDs, so treat it as a parallel rather than a direct rule for codes. The same two threats still apply. A pending code can leak through a log file, a debugging tool, or a shared database view, which is accidental disclosure. Someone with system access can also read it on purpose, which is unauthorized access. A sound design limits both by controlling who and what can read the store, and by removing each pending code once it is used or no longer needed.
Why verbatim storage is risky
Some teams store a pending code exactly as it was generated, so the value in the database matches the value in the message. The statement appears in the OWASP Session Management Cheat Sheet and is written about session values, not signup codes. The logic still applies, because a pending code is also a value that grants access while it remains valid.
The statement has two halves, and both matter. The first half is a permission with a condition: verbatim storage can be acceptable, but only in a store that is tightly controlled. The second half names the risk the condition is meant to contain. Anyone who can read the store can reuse a value that has not expired. For a signup flow, that means a reader of the pending-code table could enter a code that has not yet expired and pass the check as if they were the person who received it.
Turn this into a plain test. Who can read the table that holds pending codes? Include database administrators, analysts running reports, backup jobs, support tools, and any service account with read access. If the list is long, the store is not tightly controlled, and verbatim storage is hard to defend. If the list is short and each entry is reviewed, the condition in the OWASP statement is closer to being met.
Expiry matters too. The statement speaks of values that have not expired, so the time a pending code stays valid is part of the risk. A code that stays valid for a long window gives a reader a longer opportunity to use it. Shorten the window, remove each code once it is used, and clear any that expire unused. These steps do not replace a controlled store, but they shrink what a reader can do with what they find.
Handling duplicate code requests
A signup form can send the same code request twice. A person may tap a button again, a browser may retry, or a slow response may prompt a second send. The question is what the service does when it sees a request it has already handled. Chargebee's event documentation gives a clear rule for repeats: "If the event has not been processed, process it; otherwise, it is a duplicate event, so it can be ignored." The rule comes from the Chargebee API documentation on events.
The source is about events, not code requests, so apply the idea rather than the exact wording. Each code request should carry a record of whether it was handled. The first time the service sees a request, it acts on it and records the outcome. Any later copy is checked against that record. If the earlier copy was handled, the copy is ignored. This keeps one request from producing two codes, two notices, or two attempts counted against the person.
Ignoring a duplicate must not mean failing silently. The point of the rule is that the repeat does no further work, not that the person receives confusing feedback. Decide in advance what the screen shows when a repeat arrives, such as a plain note that a code has already been sent and where to look for it. The check has to run before the send, not after, because a message that has already left cannot be recalled. Placing the check at the front of the process also means the handled-or-not record must be written at the right moment, so the team should document exactly when a request counts as processed. For the related retry pattern, see steps to prevent duplicate welcome emails on safe retries.
Why codes can arrive late or twice
Late and repeated arrivals are normal in networked systems. Chargebee's events page says of its events: "This can be due to issues such as network delays or webhook failures." Similar causes can affect code requests, and the Chargebee events documentation gives the full context.
Network delays mean a request can take longer than expected to reach its destination. A person who sees no code may tap resend, and then the first request arrives after the second. The service receives the two requests out of order, and the order it sees them in does not match the order the person made them. A design that assumes each request arrives once and on time will treat the late copy as new when it is not.
Webhook failures are a related cause. When a notification fails to reach its receiver, the sender may try again. A retry helps when the first attempt was lost, but it means the receiver may see the same message more than once. The receiver then needs a way to tell a fresh message from one it already handled, which connects directly to the processed-or-duplicate rule above.
For a signup team, the practical lesson is to design for both cases before they happen. Treat every send as something that can be delayed or repeated, keep a record of what has been handled, and test resend behavior by deliberately sending a request twice. Running this test during development surfaces the problem before release.
Which one should you pick?
When a team decides how to keep pending codes, two choices come up most often. The table below compares them against the sources in this post. The secure-storage wording in OWASP's session guidance is a useful parallel for both options, though it is written about session IDs. It says the storage must protect against "local or remote accidental disclosure or unauthorized access." The real difference is whether the store is tightly controlled, because the verbatim option can be acceptable only in that case.
| Option | Guidance | Figures to record |
|---|---|---|
| Verbatim codes in a tightly controlled store | Acceptable by analogy to OWASP's session-storage condition, if the store is tightly controlled | Binding code at least 40 bits when the identifier was entered in the previous step |
| Verbatim codes in a store many people can read | Risky, because anyone who can read the store can reuse values that have not expired | The same 40-bit floor still applies to the code itself |
The first row can be acceptable, but only with a written list of who can read the store. That condition holds only if the list stays short. Review it on a schedule, and remove access that is no longer needed. A tightly controlled store is a condition the team must keep meeting, not a box to tick once.
The second row is risky. Even when the code meets the 40-bit floor, a reader of the store can still reuse a live code. Length protects against guessing and storage protects against reading, so a team needs both. Record the code length and the store's reader list together in the same document, so a reviewer can see both halves of the decision at once.
Table: processed or ignored requests
The Chargebee events documentation sets out a two-way decision for each incoming request, and the table below turns it into two states a signup service can check.
| State of incoming request | Action |
|---|---|
| Not yet processed | Process it |
| Already processed (duplicate) | Ignore it |
The table has two rows because the rule has two outcomes. The work is in deciding how the service knows which state a request is in. Store a handled flag for each request before acting on it, and check that flag when a copy arrives. Writing the flag at the right time is a step that needs deliberate design. If the flag is set after the send, a crash between the two can leave a request that was sent but never marked, so a retry sends again. If the flag is set before the send, a failed send can leave a request marked as handled when no code was delivered. The team should decide which failure is acceptable and test both paths.
A short test script can check the rule. Send one request, confirm one code is produced, then send the same request again and confirm the second copy is ignored. Then send a request that the service has never seen and confirm it is processed. These three checks cover the two states in the table and the transition between them.
Your next step today: run these three checks against your current signup code path and write down the results.
Related guides: Address-level fields: 4 levels for signup forms · 5 preset percentiles to read for signup time in Amplitude.
Reader questions
Is 40 bits a maximum or a minimum? It is a minimum, so a longer code still meets the rule. The NIST guidance states the figure.
When does the 40-bit rule apply? It applies when the code is used with an identifier that was entered in the previous step. The condition appears in the same NIST guidance, next to the minimum length.
Why does NIST say binding instead of issuance? NIST uses binding rather than issuance so that one term covers both enrollment and later approval of a new method. The NIST guidance describes both.
Do failed code attempts have to be counted on the server? Yes, for a code your own service checks. NIST's section 3.2.2 places the count with the CSP or verifier, which for a signup form is usually your server. The NIST guidance has the full wording, including the exception for activation factors verified at the authenticator.
Can I store pending codes exactly as generated? Only if the store is tightly controlled, by analogy with OWASP's session guidance, which notes that anyone who can read the store can reuse values that have not expired. That guidance is written about session values, so apply it with care. The OWASP Session Management Cheat Sheet contains the full wording.
What should happen if the same code request arrives twice? The service should process a request that has not been processed and ignore a duplicate of one that has. The idea comes from Chargebee's events documentation, applied here by analogy. Pair it with a clear message on screen so the person is not confused.
Why do code requests arrive late or more than once? Delays and retries are normal in networked systems, so the design should assume they happen. Chargebee's events page lists network delays and webhook failures as possible causes for its events, and similar causes can affect code requests. The Chargebee events page gives the context.
What is the simplest safe way to handle repeats? Record whether each request has been handled, check that record before acting, and test a deliberate double send. This applies the processed-or-duplicate idea from Chargebee's events documentation, adapted here to code requests, and makes the behavior easy to verify.