TL;DR: Vibe coding can generate plausible-looking authentication code, but it routinely misses token expiry handling, CSRF checks, refresh token rotation, and password hashing safeguards, according to WorkOS. The governance lesson is clear: auth is infrastructure with adversarial failure modes, not a place to trust pattern-matched code generation.
NHIMG editorial — based on content published by WorkOS: Vibe code everything except your auth
Questions worth separating out
Q: How should teams decide whether to use generated auth code in production?
A: Use generated auth code only for prototypes, throwaway experiments, or scaffolding that will be replaced before release.
Q: Why do homegrown authentication flows create so much security risk?
A: Homegrown auth concentrates risk in a control plane that handles sessions, tokens, redirects, and credentials.
Q: What do security teams get wrong about LLM-generated authentication code?
A: They often confuse plausible output with secure output.
Practitioner guidance
- Ban generated custom auth for production paths Allow LLM assistance for scaffolding, but require established identity services or audited libraries for login, session, token, and password flows.
- Review token lifecycle handling explicitly Check token expiry, refresh, revocation, and replay handling in every auth implementation.
- Test adversarial auth paths before release Add tests for CSRF, OAuth state mismatches, redirect abuse, session fixation, and password storage weaknesses.
What's in the full article
WorkOS's full post covers the operational detail this post intentionally leaves for the source:
- Step-by-step CLI installation flow for integrating AuthKit into a live codebase.
- Framework detection and SDK wiring details across supported stacks and router variants.
- Restricted-permissions agent behaviour and build-validation mechanics for reviewing generated changes.
- Practical commands for diagnosing, claiming, and inspecting a temporary environment.
👉 Read WorkOS's analysis of vibe-coded authentication and AuthKit →
Vibe coded authentication: what IAM teams should not delegate?
Explore further
Authentication is the wrong place for probabilistic code generation. Vibe coding works best where incorrect output is visible and disposable, but auth failures are usually latent and exploitable. A login flow that seems to work can still leak trust assumptions into session handling, token verification, and credential storage. Practitioners should treat generated auth as untrusted until proven otherwise.
A few things that frame the scale:
- 96% of technology professionals identify AI agents as a growing security threat, and 66% believe this risk is immediate, according to AI Agents: The New Attack Surface report.
- Only 52% of companies can track and audit the data their AI agents access, leaving 48% with a complete blind spot for compliance and breach investigation.
A question worth separating out:
Q: How do teams keep auth velocity without accepting weak controls?
A: Separate fast scaffolding from trusted implementation. Let AI generate drafts, then require human review, security testing, and established identity services for the parts that actually protect users. That keeps delivery speed high without turning authentication into an ungoverned experiment.
👉 Read our full editorial: Vibe coded auth fails because identity needs exactness, not plausibility