What problem does it solve?
This Skill provides a clear, production-minded approach to implementing authentication and authorization so teams can safely handle user login, session management, social sign-in, and permission enforcement without common security pitfalls.
Core Features & Use Cases
- JWT and Token Rotation: Patterns for short-lived access tokens and rotating refresh tokens stored in secure httpOnly cookies to mitigate token theft.
- Session Management & Middleware: Server-side session advice and auth middleware for protecting routes and extracting user context.
- OAuth2 / Social Login: Authorization code flow, state parameter handling for CSRF protection, and guidance for linking external identities to local users.
- RBAC & Permissions: Role and permission design patterns with middleware to enforce fine-grained access control.
- MFA Options: TOTP (authenticator apps) and guidance for SMS-based verification with provider recommendations.
- Managed Provider Guidance: When to use Clerk, Auth0, Supabase, NextAuth, or build a custom solution for compliance needs.
- Use Case: Build a SaaS product sign-up and login system that supports Google sign-in, role-based admin features, and secure token refresh for single-page apps.
Quick Start
Implement JWT access tokens with refresh token rotation using secure httpOnly cookies, add OAuth2 Google login with state verification, and enforce RBAC middleware on protected endpoints.