Authentication & Identity Integrations¶
How users prove they are who they say they are. Plus 2FA, SSO, and the password-hashing primitives. For the authorization layer (RBAC, who-can-do-what once they're in), see Security-Patterns.md.
Portfolio map¶
| Layer | Default |
|---|---|
| Local password auth | bcrypt (bcrypt / bcryptjs in Node, passlib+bcrypt in Python, Laravel hashing in PHP) |
| Session token | JWT (signed, short-lived) + refresh token — or server-side sessions (Toolbelt Handyman, APEX, Sell Me A Pen, Tutor AI) |
| Social login | Google + Microsoft (Passport.js, NextAuth, Socialite, authlib) |
| MFA | TOTP (otpauth / pyotp) — DOC-AI, GGPI website, GoGreen Verify, PoligoPro, Recruiting AI, Tutor AI, OpenSentinel |
| Enterprise SSO | SAML — DOC-AI (pysaml2 + SCIM), SmartForms (python3-saml) |
OAuth providers¶
Google OAuth 2.0¶
Used in: Sourcing AI, SuperCabs, GameTrakker, DOC-AI, GoGreen Seller AI, AutoDiag AI, APEX Sales Training, Recruiting AI, Tutor AI (Passport), Jarvis (Tauri; Google Calendar access via the oauth2 crate, not a login), PoligoPro, VotigoPro (Socialite), Maximus Pet Store (Socialite), Pecos River Traders (Socialite), GGPI website. AI Concierge keeps Google routes but the login buttons were removed 2026-10-02 (email + password only). Sell Me A Pen has Google client IDs in .env.example. The default social login.
Pattern: "Sign in with Google" → ID token → look up or provision user → issue local JWT/session.
Microsoft OAuth (Microsoft Identity Platform / Entra ID)¶
Used in: Sourcing AI (Azure AD), GameTrakker (Azure AD), DOC-AI, GoGreen Seller AI, AutoDiag AI, APEX Sales Training, Recruiting AI, Tutor AI (Passport), PoligoPro (Azure AD), VotigoPro (socialiteproviders), Maximus Pet Store and Pecos River Traders (Socialite), GGPI website (Entra). Paired with Google in nearly every social-login flow.
Facebook OAuth¶
Used in: GoGreen Seller AI (Passport strategy). PoligoPro and VotigoPro carry Facebook provider env vars.
Apple OAuth (Sign in with Apple) (not used in portfolio)¶
Not used in portfolio — covered for comparison. Required by Apple's app-store rules when an iOS app offers other social logins.
LinkedIn OAuth¶
Not a sign-in path in the portfolio. LinkedIn appears as a publishing/integration target: Marketing AI stores AES-encrypted OAuth tokens for social/ad platforms, and the GGPI website cross-posts blog posts to LinkedIn through Marketing AI's core-api. Recruiting AI has a linkedin.service.ts job-board integration.
GitHub OAuth¶
Not used as a user sign-in path in the portfolio (PoligoPro lists a GitHub provider env var only). GitHub API access is used by OpenSentinel (Octokit) and a Workflow Hub adapter — see Integrations-CRM-Workflow.md.
NextAuth.js (now Auth.js)¶
What it is. Authentication framework for Next.js. Handles OAuth providers, credentials, magic links, JWT/session cookies, the /api/auth/* routes, callback signing.
Used in: Sourcing AI (v4, JWT strategy, vendored @dsiemon2/auth — env-conditional Credentials + Google + Azure AD), GameTrakker (v4.24, same provider set), Do Me A Ditty (v4.24 via @dsiemon2/auth), PoligoPro (v4), SuperCabs (v5 beta with @auth/prisma-adapter; Credentials + Google), SmartForms frontend (v4.24), HouseKey admin (v4).
Adapter: @auth/prisma-adapter (SuperCabs).
Why we use it. It's the answer when the framework is Next.js and you don't want to wire OAuth callbacks by hand.
Passport.js¶
What it is. Express-era authentication middleware. Strategy-per-provider — passport-google-oauth20, passport-microsoft, passport-facebook, etc.
Used in: GoGreen Seller AI (local, Google, Microsoft, Facebook, generic OAuth2), APEX Sales Training (local, Google, Microsoft), Recruiting AI (Google, Microsoft), Tutor AI (Google, Microsoft).
Why over NextAuth: Express apps. Passport's strategy ecosystem is enormous; NextAuth doesn't fit non-Next.js stacks.
Laravel Sanctum¶
What it is. Laravel's first-party API token auth. Personal access tokens, SPA cookie-based sessions.
Used in: VotigoPro — Sanctum tokens for the web app and mobile app (with refresh), Socialite for Google/Microsoft, spatie/laravel-permission for roles. The WordPress plugin keeps an admin token in wp_options plus a per-voter Sanctum token cookie. Maximus Pet Store and Pecos River Traders — Sanctum ^4 tokens on their REST APIs, with Socialite ^5 (Google + Microsoft) and Laravel session auth on the storefronts.
JWT (JSON Web Tokens)¶
What it is. RFC 7519 — a signed (HS256 or RS256) JSON payload that the client carries in Authorization: Bearer .... Stateless: server validates the signature, no session lookup.
Used in: SuperCabs, BidIt, Workflow Hub, Sourcing AI (NextAuth JWT strategy), DOC-AI, Marketing AI, GoGreen Verify, Go Green Transit, GoGreen Seller AI, AutoDiag AI, AI Concierge, SmartForms, APEX Sales Training (api-token service for mobile), Recruiting AI, Tutor AI, HouseKey, GGPI website.
Pattern:
- Short-lived access token in Authorization header — GGPI website uses 15 min access + 7 day refresh; SmartForms uses 30 min + 7 days.
- Long-lived refresh token (cookie or stored record — GoGreen Verify keeps a RefreshToken model).
- Refresh endpoint rotates tokens.
Libraries:
- jsonwebtoken (Node — most apps), jose (SuperCabs).
- PyJWT (DOC-AI; python-jose was removed there 2026-10-05), python-jose (AutoDiag AI, SmartForms).
- golang-jwt (Go — Marketing AI).
- Workflow Hub pairs JWT with CASL RBAC (better-auth is also in its API dependencies; CLAUDE.md describes JWT + CASL).
Common mistake to avoid. Don't put PII in JWTs — they're not encrypted, just signed. Anyone with the token can read its body.
Server-side sessions¶
What it is. A session cookie pointing at server-held state instead of a self-contained token.
Used in: Toolbelt Handyman (express-session + connect-redis), Tutor AI (express-session + connect-redis, alongside JWT), APEX Sales Training (express-session + connect-redis, plus a JWT api-token for mobile), Sell Me A Pen (cookie sessions + admin token), Maximus Pet Store and Pecos River Traders (Laravel session auth). GameTrakker's floor-staff PIN login uses an HMAC-signed cookie (Bearer token for the mobile app).
SAML / SSO¶
What it is. Enterprise federated single-sign-on. The IdP (Okta, Azure AD, Google Workspace) issues a signed XML assertion, your app trusts it.
Used in:
- DOC-AI — pysaml2 for SAML/SSO, with SCIM provisioning and SSO hardening.
- SmartForms — python3-saml (SAML_ env).
- Recruiting AI* — has an SSO service (sso.service.ts).
TOTP / 2FA¶
What it is. Time-based one-time password (RFC 6238). The shared secret + current Unix timestamp generates a 6-digit code; Google Authenticator / Authy / 1Password produce them.
Libraries seen:
- otpauth (Node — GGPI website).
- pyotp (Python — DOC-AI; MFA required for Owners/Admins).
Used in: DOC-AI, GGPI website (TOTP 2FA), GoGreen Verify (services/mfa.ts), PoligoPro (2FA endpoints), Recruiting AI, Tutor AI, OpenSentinel (two-factor-auth module), Toolbelt Handyman (TOTP referenced in source).
Pattern: during enrollment, server generates a secret + QR code; user scans with their authenticator app; future logins require the 6-digit code in addition to password.
API keys¶
What it is. Long-lived machine credentials sent in a header (x-api-key / X-API-Key). Stored hashed; shown once.
Used in: GGPI website (SHA-256, scoped, fail-closed), DOC-AI (rate-limited per org; docai_live_...), GoGreen Verify (plan limits), GameTrakker (gtk_... org keys, Enterprise), Go Green Transit (hashed, per-key rate limit + monthly cap), AI Concierge (tenant keys with mcp:read scope for MCP), SmartForms (SHA-256 digest at rest).
Ed25519 license signing¶
What it is. Public-key signatures over a license payload, so a desktop app can verify entitlement offline.
Used in: Go Green Transit — licenses signed with Ed25519 (@noble/ed25519), verified offline on the desktop app, with online revocation via /license/heartbeat.
Persona (KYC / ID verification)¶
What it is. Identity verification API — driver's-license/passport scan, selfie liveness, cross-checks.
Used in: Recruiting AI and GoGreen Verify (persona.service.ts).
ID Analyzer¶
What it is. Competitor to Persona — same shape (scan + liveness + risk score) via a REST API.
Used in: Recruiting AI (idVerification flow) and GoGreen Verify (idAnalyzer.service.ts).
Didit¶
What it is. A third ID-verification vendor with the same scan + liveness shape.
Used in: Recruiting AI and GoGreen Verify (didit.service.ts).
Why several. A/B / fallback. Recruiting AI also calls GoGreen Verify's /v1/verify/id API (with GGV_API_KEY and a biometric-consent attestation) as its own verification path.
Password hashing¶
| Algorithm | Where |
|---|---|
| bcrypt | Every in-scope app that stores passwords (bcrypt, bcryptjs, passlib+bcrypt, Laravel BCRYPT_ROUNDS). GameTrakker also bcrypt-hashes staff PINs. |
| Argon2 | Not used in the portfolio — covered for comparison. State-of-the-art; new code could adopt it. |
| PBKDF2 | Not used — bcrypt is a direct upgrade. |
| scrypt | Not used. |
CSRF protection¶
What it is. Cross-Site Request Forgery — a malicious site tricks the user's browser into making a state-changing request to your site, leveraging the user's existing cookies.
Mitigations seen:
- Token middleware — GGPI website (csrf.ts), Sell Me A Pen (csurf).
- Synchronizer token — Laravel apps (Maximus Pet Store, Pecos River Traders, VotigoPro).
- SameSite cookies — universal (SameSite=Strict for auth cookies, Lax for general).
Comparison alternatives (not used)¶
| Service | Notes |
|---|---|
| Auth0 | Managed identity SaaS. Closest to "use it for everything." Self-hosted Postgres + NextAuth/Passport.js wins on cost. |
| Clerk | Great DX for Next.js. NextAuth is good enough; Clerk is paid. |
| Supabase Auth | Tied to Supabase Postgres. Portfolio is self-hosted Postgres. |
| Firebase Auth | Google-controlled identity. Not used. |
| AWS Cognito | Cloud-native. Not used. |
| Lucia | Lightweight Auth.js alternative. Not adopted. |
| WorkOS | Enterprise SSO-as-a-service. SAML directly (pysaml2 / python3-saml) wins on cost for the few enterprise tenants. |
Decision guide¶
Next.js app, want quick OAuth? NextAuth + Google + Microsoft.
Express app, want strategy ecosystem? Passport.js.
Laravel app? Sanctum + Socialite.
Need MFA? otpauth / pyotp + QR enrollment.
Need enterprise SSO? pysaml2 / python3-saml.
Need KYC / identity verification? Persona, ID Analyzer or Didit (or GoGreen Verify's /v1 API).
Need machine-to-machine access? Hashed, scoped API keys.
Need offline-verifiable licenses? Ed25519 signatures.
Need to hash passwords? bcrypt (Argon2 for new code).