What problem does it solve?
Inconsistent and insecure authentication/authorization logic across Express routes leads to security gaps and maintenance headaches. This skill provides a centralized, reusable JWT/API-key/session-based authentication and role-based authorization middleware to enforce consistent security across the API surface.
Core Features & Use Cases
- Authenticate & Authorize: verify tokens (JWT or API keys), attach user data to requests, and enforce access control.
- RBAC Enforcement: restrict routes to specific roles, with clear 401/403 handling and secure defaults.
- Safe Defaults & Extensibility: designed for easy extension to additional auth strategies and configurable error messages; suitable for admin dashboards and user-facing APIs.
Quick Start
Integrate the middleware into the Express app by applying authenticate and authorize to protected routes.