auth-implementation-patterns

Implement JWT, OAuth2, and RBAC authentication patterns in TypeScript and Node.js.

Updated Dec 16, 2025
One-click install
npx skills add https://github.com/EanLee/article-write --skill auth-implementation-patterns-eanlee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-implementation-patterns
Source: https://github.com/EanLee/article-write/tree/main/.github/skills/auth-implementation-patterns
Command: npx skills add https://github.com/EanLee/article-write --skill auth-implementation-patterns-eanlee

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill 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 mechanisms in applications, ensuring secure user access and data protection.

Core Features & Use Cases

  • Authentication Strategies: Covers JWT, session-based, and OAuth2/OpenID Connect.
  • Authorization Patterns: Implements Role-Based Access Control (RBAC), permission-based checks, and resource ownership verification.
  • Security Best Practices: Includes password security, rate limiting, and common pitfalls to avoid.
  • Use Case: Secure a web API by implementing JWT authentication for user login and role-based access control 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 Node.js API?

To implement JWT authentication for a Node.js API, you use TypeScript code examples that integrate Passport.js to verify user identity and secure API endpoints. This provides robust token-based session management.

What is the best way to set up Role-Based Access Control in TypeScript?

The best way to set up Role-Based Access Control (RBAC) in TypeScript is by applying permission-based checks and resource ownership verification patterns to protect sensitive endpoints and manage user access control.

How does OAuth2 compare to session-based authentication for secure API design?

OAuth2 provides secure third-party delegation for identity verification, while session-based authentication manages user login state locally. Both mechanisms secure API design but serve different access control requirements.

Do I need Passport.js and bcrypt to secure user login in Node.js?

You need Passport.js and bcrypt to secure user login in Node.js because they handle identity verification and password security respectively, preventing common security pitfalls during the authentication process.

What are common security pitfalls when implementing authorization systems?

Common security pitfalls when implementing authorization systems include neglecting rate limiting, improper password security handling, and failing to verify resource ownership, which can expose sensitive API endpoints to unauthorized access.

Can I use this to add authentication strategies to an existing web API?

Yes, you can use these TypeScript patterns to add authentication strategies to an existing web API, integrating JWT, session-based, or OAuth2 mechanisms to ensure secure user access and data protection.