Authentication
The Boring JavaScript Stack uses session-based authentication with multiple sign-in methods. The Ascent templates provide production-ready implementations of password auth, magic links, passkeys, two-factor authentication, password reset, and OAuth — all built on Sails.js actions, helpers, and policies.
When to Use
Use this skill when:
- Implementing signup and login flows (password or magic link)
- Adding passkey (WebAuthn) support with
@simplewebauthn
- Setting up two-factor authentication (TOTP, email codes, backup codes)
- Building password reset flows with secure token handling
- Integrating OAuth providers (Google, GitHub) via
sails-hook-wish
- Configuring authentication policies (
is-authenticated, is-guest, has-partially-logged-in)
- Understanding the
req.me / req.session.userId pattern and return URL handling
- Working with the User model's auth-related attributes and lifecycle callbacks
Rules
Read individual rule files for detailed explanations and code examples:
- rules/getting-started.md - Auth architecture, User model overview, policies, req.me, return URL
- rules/password-auth.md - Signup and login flows, password hashing, remember me, validation
- rules/magic-links.md - Token generation/hashing, request/verify actions, auto-signup, security
- rules/passkeys.md - WebAuthn with @simplewebauthn, registration and authentication flows
- rules/two-factor.md - TOTP, email 2FA, backup codes, partial login state, verify-2fa action
- rules/password-reset.md - Forgot/reset flow, token lifecycle, email integration, security
- rules/oauth.md - Wish library, Google/GitHub OAuth, redirect/callback, findOrCreate pattern
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: sailscastshq-boring-stack-authentication3description: Authentication4---56# Authentication78The Boring JavaScript Stack uses **session-based authentication** with multiple sign-in methods. The Ascent templates provide production-ready implementations of password auth, magic links, passkeys, two-factor authentication, password reset, and OAuth — all built on Sails.js actions, helpers, and policies.910## When to Use1112Use this skill when:1314- Implementing signup and login flows (password or magic link)15- Adding passkey (WebAuthn) support with `@simplewebauthn`16- Setting up two-factor authentication (TOTP, email codes, backup codes)17- Building password reset flows with secure token handling18- Integrating OAuth providers (Google, GitHub) via `sails-hook-wish`19- Configuring authentication policies (`is-authenticated`, `is-guest`, `has-partially-logged-in`)20- Understanding the `req.me` / `req.session.userId` pattern and return URL handling21- Working with the User model's auth-related attributes and lifecycle callbacks2223## Rules2425Read individual rule files for detailed explanations and code examples:2627- [rules/getting-started.md](rules/getting-started.md) - Auth architecture, User model overview, policies, req.me, return URL28- [rules/password-auth.md](rules/password-auth.md) - Signup and login flows, password hashing, remember me, validation29- [rules/magic-links.md](rules/magic-links.md) - Token generation/hashing, request/verify actions, auto-signup, security30- [rules/passkeys.md](rules/passkeys.md) - WebAuthn with @simplewebauthn, registration and authentication flows31- [rules/two-factor.md](rules/two-factor.md) - TOTP, email 2FA, backup codes, partial login state, verify-2fa action32- [rules/password-reset.md](rules/password-reset.md) - Forgot/reset flow, token lifecycle, email integration, security33- [rules/oauth.md](rules/oauth.md) - Wish library, Google/GitHub OAuth, redirect/callback, findOrCreate pattern3435---36> Converted and distributed by [TomeVault](https://tomevault.io/claim/sailscastshq) — claim your Tome and manage your conversions.37<!-- tomevault:4.0:skill_md:2026-04-11 -->