Auth UI is a browser/backend contract, not just a form. Use this skill when the frontend must preserve auth intent, expose the right browser hints, handle retry and expiry states, and avoid turning auth navigation into an open redirect or unusable passkey flow.
Boundary with sibling skills
- Use
frontend-security-baselinefor token storage, cookies, SameSite, CSRF, Origin/content-type gates, CSP, XSS, source maps, and open-redirect security primitives. - Use
deeplink-hydrationfor generic router readiness, cold direct-navigation tests, and URL-to-screen reconstruction. This skill owns the auth-specificreturnTo/callback contract layered on top. - Use
a11y-contract-testingfor generic role/name/focus semantics. This skill adds auth-specific autofill, error, fallback, and passkey test cases. - Use
constraint-validation-contractsfor native HTML form-validity wiring: the Constraint Validation API,:invalid/:user-invalidtiming, andsetCustomValidity()/reportValidity(). This skill owns only the auth-specificautocompletefields and credential-handling rules layered on top. - Do not implement backend crypto here: Argon2/Bcrypt, CBOR, ECDSA/RSA/EdDSA, and session-token storage are server/security implementation details. Translate them only into frontend contracts such as expiry, retry, challenge, and fallback behavior.
For detailed checklists, read references/browser-auth-contracts.md.
Default workflow
- Identify the flow: login, signup, password reset, email verification, one-time code sign-in, passkey registration/authentication, auth callback, or sensitive account action.
- Define the browser-visible contract before editing: URL inputs, allowed return destinations, form fields/autocomplete, pending/expired/retry states, error copy, and fallback paths.
- Add or update tests that enter from a cold URL, assert accessible form/error semantics, and cover failure states (expired code, invalid return URL, passkey cancel/unsupported/pending).
- Keep backend constraints explicit in the UI contract: server-issued challenges, one-time code invalidation, rate-limit/retry windows, and fresh verification for high-risk actions.
Quick contract map
| Area | Frontend contract |
|---|---|
| Auth redirects | Preserve intended destination, but validate returnTo/next/callback targets before restoring. |
| Password forms | Do not silently trim/normalize/sanitize credentials; use correct autocomplete and generic login errors. |
| Email/code flows | Show expiry/retry/resend state; always set autocomplete="one-time-code" (a standard hint — iOS/macOS Safari autofills from it) and add the WebOTP API for Android Chrome's SMS retrieval; avoid account enumeration. |
| Passkeys/WebAuthn | Use server challenges, feature detection, conditional mediation fallback (its promise can stay pending indefinitely — never gate the login UI on awaiting it), and passkey autofill hints. |
| Sensitive actions | Require fresh identity verification before password/email/passkey/account destructive changes. |
| Tests | Direct-navigation auth URLs, accessible errors, autocomplete attributes, invalid-return rejection, expired-code and passkey-cancel paths. |
PR-worthiness gate
Require one concrete auth flow and a browser-visible contract failure: lost or unsafe return destination, incorrect credential/autocomplete behavior, enumerating error, expired/retry state with no recovery, passkey fallback failure, or missing fresh verification for a sensitive action. Add the smallest flow test.
Reject weak findings: token/cookie/CSP/CSRF primitives owned by
frontend-security-baseline, backend cryptography choices, generic form
validation with no auth-specific contract, or a passkey/OTP API mention whose
cancel, expiry, fallback, and error paths already work.
Output shape
A good auth-flow review deliverable names the specific flow under review (login,
signup, reset, verification, one-time code, passkey, callback, or sensitive action).
It states the browser-visible contract that flow must uphold: URL inputs, returnTo/
callback validation, autocomplete/credential fields, and pending/expired/retry/error
states. It identifies the one failing contract with concrete evidence (URL, field,
state, or test), then gives the minimal fix direction rather than a backend redesign.
Sources
- OWASP Authentication Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html
- OWASP Cross-Site Request Forgery Prevention Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html
- OWASP Session Management Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html
- W3C Web Authentication (WebAuthn) Level 2: https://www.w3.org/TR/webauthn-2/
- NIST SP 800-63B-4: https://pages.nist.gov/800-63-4/sp800-63b.html
- MDN Web Authentication API: https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API
- MDN HTML
autocompleteattribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete - MDN WebOTP API (Android Chrome SMS one-time-code retrieval, additive to the
autocompletehint): https://developer.mozilla.org/en-US/docs/Web/API/WebOTP_API