auth-implementation-patterns

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

1|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/ralphjohn29/my-claude-skills --skill auth-implementation-patterns-ralphjohn29
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-implementation-patterns
Source: https://github.com/ralphjohn29/my-claude-skills/tree/main/auth-implementation-patterns
Command: npx skills add https://github.com/ralphjohn29/my-claude-skills --skill auth-implementation-patterns-ralphjohn29

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jsonwebtoken, express-session, passport, bcrypt, express-rate-limit, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides comprehensive solutions for implementing secure and scalable authentication and authorization systems, addressing common security vulnerabilities and complex access control requirements.

Core Features & Use Cases

  • Authentication Strategies: Implement session-based, JWT-based, and OAuth2/OpenID Connect flows.
  • Authorization Models: Utilize Role-Based Access Control (RBAC), permission-based checks, and resource ownership verification.
  • Security Best Practices: Enforce password security, implement rate limiting, and protect against common attacks.
  • Use Case: Secure a new API endpoint by implementing JWT authentication and ensuring only users with the 'admin' role can access it.

Quick Start

Implement JWT authentication for your Express.js API using the provided middleware and token generation patterns.

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 in an Express.js API?

To implement JWT authentication in Express.js, use the jsonwebtoken library for token generation and middleware to verify tokens on protected API endpoints. This Skill provides ready-to-use patterns for both token creation and route protection.

What's the best way to set up Role-Based Access Control for API endpoints?

Role-Based Access Control (RBAC) is best implemented by assigning roles to users and checking permissions via middleware before route access. This Skill includes RBAC patterns and resource ownership verification to ensure only authorized roles access specific endpoints.

How does token refresh flow work with OAuth2 and session management?

OAuth2 token refresh flows exchange expired access tokens for new ones using refresh tokens, maintaining secure sessions without repeated logins. This Skill covers session management and token refresh patterns for scalable access control.

Can I use Passport and bcrypt for password hashing and session management?

Yes, you can use Passport for authentication session management and bcrypt for secure password hashing. This Skill integrates both dependencies to enforce password security and manage session-based authentication flows.

How do I protect my API against brute force attacks with rate limiting?

Protect APIs against brute force attacks by applying express-rate-limit middleware to restrict request frequency from individual clients. This Skill configures rate limiting to block excessive authentication attempts and mitigate common attacks.