auth-implementation-patterns

Implement JWT, OAuth2, session, and RBAC authentication patterns.

Updated Sep 10, 2025
One-click install
npx skills add https://github.com/cuoreinpace/bdeornelas.github.io --skill auth-implementation-patterns-cuoreinpace
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-implementation-patterns
Source: https://github.com/cuoreinpace/bdeornelas.github.io/tree/main/plugins/developer-essentials/skills/auth-implementation-patterns
Command: npx skills add https://github.com/cuoreinpace/bdeornelas.github.io --skill auth-implementation-patterns-cuoreinpace

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jsonwebtoken, express-session, passport, passport-google-oauth20, passport-github2, bcrypt, zod, express-rate-limit, rate-limit-redis, connect-redis, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and code examples for implementing robust authentication and authorization systems, ensuring secure and scalable access control for applications.

Core Features & Use Cases

  • Authentication Strategies: Covers session-based, JWT, and OAuth2/OpenID Connect.
  • Authorization Models: Implements Role-Based Access Control (RBAC), permission-based control, and resource ownership checks.
  • Security Best Practices: Includes password security, rate limiting, and common pitfalls to avoid.
  • Use Case: Secure a new REST API by implementing JWT-based authentication for user login and role-based authorization to protect sensitive endpoints.

Quick Start

Implement JWT authentication for your API using the provided TypeScript examples.

Frequently Asked Questions about auth-implementation-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement JWT authentication for a REST API?

JWT authentication secures a REST API by issuing tokens upon user login and verifying them on protected endpoints. This Skill provides TypeScript examples to implement token-based flows, role-based authorization, and permission matrices for scalable access control.

What is the best way to set up OAuth2 with Passport?

OAuth2 with Passport supports Google and GitHub login strategies. This Skill implements OAuth2/OpenID Connect flows using passport-google-oauth20 and passport-github2, enabling secure third-party authentication and session management for your applications.

How do I secure API endpoints with RBAC and permission checks?

Securing endpoints with RBAC involves mapping user roles to specific permissions and verifying resource ownership. This Skill provides patterns for permission matrices and role hierarchies to enforce scalable access control across your API.

Does this auth implementation require Redis for rate limiting?

Redis is used for rate limiting to secure APIs against brute force attacks. This Skill integrates rate-limit-redis and connect-redis with express-rate-limit and express-session to manage distributed rate limits and store session data securely.

When should I use session-based authentication instead of JWT?

Session-based authentication is preferred for server-rendered apps needing immediate revocation, while JWT suits stateless APIs. This Skill covers both token-based and session-based flows, helping you choose the right strategy for your application's security needs.