Independent analysis by NHI Mgmt GroupSource article: WorkOS, “Best practices for secure user authentication” (April 21, 2026)

TL;DR: Secure authentication still fails where teams reinvent protocols, weaken password handling, or leave reset flows open to takeover, according to WorkOS, even as stolen credentials feature in roughly 80% of web application attacks and breaches average just under $5 million. Modern auth now depends on mature protocol choices, phishing-resistant factors, short-lived tokens, and tightly controlled recovery paths.


At a glance

What this is: NHI Mgmt Group's analysis, drawing on WorkOS's blog post: The highest-risk secure authentication mistakes are custom protocols, weak credential handling, and reset flows that reopen account takeover paths.

Why it matters: It matters because IAM teams have to harden authentication, recovery, and session controls before attackers exploit reusable credentials, weak factors, or unsafe reset workflows.

By the numbers:

  • Stolen credentials are implicated in roughly 80% of web application attacks.

Context

Authentication often fails at the seams between protocol choice, token handling, password policy, and account recovery. The core problem is not that cryptography is unavailable, but that teams still introduce avoidable trust gaps when they customize what established standards already cover.

For IAM programmes, this is a human identity control problem with direct implications for SSO, MFA, passwordless adoption, and session governance. The article treats secure authentication as an implementation discipline, not a feature toggle, and that is the right frame for practitioners.

The practical question is whether your authentication design reduces replay, phishing, and recovery abuse without creating brittle exceptions for real users. In most environments, that means aligning the login flow, factor hierarchy, and reset path before the first audit or incident exposes the gaps.


Key questions

Q: What are the best practices for secure user authentication in web apps?

A: Use established protocols instead of custom auth code, prefer phishing-resistant factors such as passkeys, and keep sessions short-lived with refresh token rotation. Passwords should be treated as a fallback control, not the centre of the design. Recovery flows must be single-use, time-limited, and re-authenticated before they can change trust settings.

Q: Why do password reset flows attract fraud and account takeover attempts?

A: Password reset flows restore access when identity is weakest, so attackers target them to convert a fresh foothold into durable control. If recovery depends on email continuity or other easily abused signals, fraudsters can bypass ordinary login protection. Teams should treat recovery as a higher-risk identity event than sign-in.

Q: How do security teams know whether token rotation is actually working?

A: Look for short credential lifetimes, automatic revocation of old tokens, and no successful reuse after rotation. If access logs still show valid calls from old credentials, rotation is not functioning as a containment control. Effective programmes measure time to invalidation, not just the existence of a rotation policy.

Q: What is the difference between passkeys and security keys for passwordless authentication?

A: Passkeys store the public and private key pair in the user’s iCloud Keychain and can sync across the user’s devices, which makes them convenient for everyday login. Security keys keep the key pair on a physical device such as a USB key or security card. Both support passwordless authentication, but they differ in portability, recovery model, and physical possession requirements.


Technical breakdown

Why custom authentication protocols fail

Most authentication incidents do not start with broken cryptography. They start when teams invent custom token formats, custom session schemes, or custom parsers for SAML or OIDC, then miss a validation step that established libraries would have handled. The real risk is not just implementation complexity, but trust errors in issuer, audience, signature, and key rotation checks. Standards such as OAuth 2.1, OpenID Connect, SAML 2.0, and WebAuthn already encode the hard parts. When teams bypass them, they create an authentication path that is harder to verify and easier to misconfigure.

Practical implication: Use vetted protocol libraries and treat custom auth logic as an exception requiring explicit security review.

How passkeys and short-lived tokens change session risk

Passkeys reduce phishing exposure because the credential is bound to the origin that registered it, and the server stores only public keys. That removes the shared secret problem that makes password databases so valuable to attackers. The other half of the session story is token lifetime. Short-lived access tokens limit exposure, while refresh token rotation and reuse detection let the server invalidate an entire token family when an old token reappears. In practice, this shifts the control point from password strength to session integrity and token lifecycle.

Practical implication: Prefer phishing-resistant sign-in and enforce refresh token rotation with reuse detection for every session family.

Why reset flows and password policies remain high-risk

Password reset is often the easiest route to permanent account takeover because it can bypass strong passwords, MFA, and device trust if it is weakly designed. The same is true for email or recovery-method changes. Strong reset design uses single-use, short-lived tokens, re-authentication before recovery changes, and session invalidation after a successful reset. Password policy matters too, but only in the modern sense: long passphrases, breach checking, no composition rules, and no forced periodic rotation without cause. The objective is to reduce credential replay and recovery abuse, not to force memorisable complexity.

Practical implication: Treat reset and recovery as critical attack surfaces and align password policy with current NIST and OWASP guidance.


Threat narrative

Attacker objective: The attacker wants durable access to the account and any sensitive actions or linked credentials that the identity can reach.

  1. Entry occurs through weak authentication design, especially custom protocol handling, exposed passwords, or a reset flow that does not re-establish trust before changing recovery settings.
  2. Credential access follows when attackers reuse stolen passwords, capture weak MFA sessions, or redeem a reset token that should have been single-use.
  3. Escalation happens when refresh token reuse is not detected and the attacker keeps a valid session family alive after the initial compromise.
  4. Impact is permanent account takeover, often extending to API keys, recovery channels, or other privileged account settings tied to the user identity.

Read and download The State of NHI & AI Agent Breach Report 2026, covering 150+ breaches impacting Non-Human Identities including AI Agents.


NHI Mgmt Group analysis

Custom authentication is an assumption trap: Most teams assume protocol choice is a plumbing decision, but it is actually a governance decision about what the security stack can verify safely. OAuth 2.1, OIDC, SAML, and WebAuthn already exist because authentication failures usually arise in the handoff between identity, tokens, and session state. The practitioner implication is that inventing bespoke auth logic usually creates more review burden than security value.

Session integrity now matters more than password policy theatrics: If an attacker can keep a session alive through token reuse, then password complexity does not matter nearly as much as the session controls around it. Refresh token rotation and reuse detection turn session persistence into an observable event instead of an invisible compromise. The implication is that authentication governance has moved from login-time checks to lifecycle control over issued credentials.

Password reset is the real account takeover boundary: The reset and recovery path is where otherwise sound authentication architectures often fail because it can re-authorize a user without re-establishing trust. That failure mode is not a missing feature, it is a broken premise that password resets are safer than logins. Practitioners should treat recovery as part of the identity trust chain, not as a side workflow.

Phishing resistance is now a baseline expectation, not an enhancement: Passkeys change the security model because the credential is bound to the origin and the server never sees a reusable secret. That makes origin binding, token lifecycle, and recovery governance more important than remembering passwords or tightening composition rules. Teams that still center authentication strategy on password strength are optimizing the least important control.

Secure authentication is really control-plane design: The article is right to frame authentication as a sequence of protocol, factor, token, and recovery choices rather than a single login feature. Once viewed that way, the discipline spans IAM, PAM-adjacent step-up controls, and lifecycle governance for every issued credential. The practitioner conclusion is that auth architecture should be reviewed as a programme, not as isolated implementation tickets.

What this signals

Reset governance is the control most likely to be under-designed: Teams often spend more time on login UX than on the recovery path that attackers actually exploit. When reset and recovery are not treated as part of the identity lifecycle, authentication strength becomes superficial because account takeover can still be re-established through a side door.

Session lifecycle now belongs in IAM governance discussions: Authentication is no longer just about proving identity at sign-in. The control surface extends to token issuance, token reuse, re-authentication triggers, and the events that force a fresh trust decision later in the session.

The strongest programmes will treat passkeys, refresh rotation, and recovery controls as one operating model rather than three separate features. That shift reduces replay risk, lowers user friction, and gives security teams a cleaner audit story when the auth stack is reviewed.


For practitioners

  • Adopt vetted auth protocols Standardise on OAuth 2.1 with PKCE, OpenID Connect for user identity, SAML only where enterprise demand requires it, and WebAuthn for phishing-resistant sign-in. Prohibit custom token formats, custom session schemes, and hand-rolled token validation unless a security architect signs off.
  • Enforce phishing-resistant factors first Make passkeys and hardware security keys the preferred sign-in methods, keep weaker factors as fallback only, and require step-up authentication for sensitive actions such as recovery changes or API key rotation.
  • Rotate refresh tokens on every use Issue short-lived access tokens, rotate refresh tokens on redemption, and revoke the entire token family immediately when reuse is detected. Store refresh tokens in secure HttpOnly cookies for browser clients.
  • Harden password reset and recovery Use single-use, short-lived reset tokens, require re-authentication before changing recovery email or phone number, and invalidate all existing sessions after a successful reset or recovery update.
  • Modernise password policy Drop composition rules and periodic rotation, allow long passphrases and every character type, and screen new passwords against breach corpora before acceptance.

Key takeaways

  • Authentication failures usually come from teams re-inventing protocols, weakening recovery flows, or treating session state as less important than login.
  • Stolen credentials remain a dominant attack path, which is why protocol discipline, phishing-resistant factors, and token lifecycle control matter together.
  • The practical control point is no longer password policy alone. It is the combination of origin-bound sign-in, short-lived sessions, and tightly governed reset paths.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5, NIST SP 800-63 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP Non-Human Identity Top 10NHI-04 — Insecure AuthenticationThe article centres on authentication design choices that create or reduce NHI trust gaps.
NHI-07 — Long-Lived SecretsRefresh token lifetime and reuse handling are central to the article's session guidance.
NHI-10 — Human Use of NHIPassword and reset workflows remain human-facing entry points into non-human credential governance.
Recommendation — Use NHI-04 to review authentication flows for origin binding, protocol validation, and factor strength. Apply NHI-07 to shorten token exposure windows and revoke reused refresh-token families immediately. Control human-facing recovery and factor enrolment paths so they cannot be used to subvert NHI sessions.
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementThe article repeatedly focuses on credential lifecycle, rotation, and recovery control.
IA-2 — Identification and Authentication (Organizational Users)User login and step-up authentication remain central human identity controls in the article.
Recommendation — Apply IA-5 to govern authenticator issuance, rotation, revocation, and reset handling. Use IA-2 to require strong user authentication before sensitive account actions.
NIST SP 800-63SP 800-63B — Authentication and Lifecycle ManagementThe article's password, authenticator, and reset guidance aligns directly with digital identity authentication practices.
Recommendation — Align password, MFA, and authenticator lifecycle decisions with SP 800-63B guidance.
NIST CSF 2.0PR.AA-05 — Access Permissions, Entitlements and AuthorizationsThe article links sign-in assurance to how access is issued and revalidated during sessions.
Recommendation — Review session and factor controls under PR.AA-05 so access stays tied to current trust.

Key terms

  • Refresh token rotation: Refresh token rotation replaces a reusable refresh token with a new one each time it is used. This limits the value of token theft because a stolen token becomes useless after the legitimate exchange, assuming the implementation handles revocation and concurrency correctly.
  • Passkey: A passkey is a passwordless credential based on public key cryptography. A private key stays on the user’s device, while a public key is stored by the service. During login, the device signs a challenge after local unlock, which reduces phishing and eliminates shared secret reuse.
  • Refresh Token: A longer-lived credential that can mint new access tokens without forcing the user to authenticate again. Because refresh tokens can preserve access for extended periods, they are a major governance concern when malicious or over-scoped applications are granted consent.
  • Origin binding: A cryptographic property that ties an authentication response to the legitimate site or service being accessed. It reduces the value of fake login pages because a credential response generated for one origin cannot be reused on another without failing verification.

Deepen your knowledge

NHI governance, agentic AI identity, and machine identity lifecycle are core topics in our NHI Foundation Level course, the industry's only accredited NHI security programme. If you are building or maturing an IAM programme, it is worth exploring.
NHIMG Editorial Note
Published by the NHIMG editorial team on June 6, 2026.
Updated on October 7, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org