auth-implementation-patterns

Implement JWT, OAuth2, and RBAC authentication patterns in web applications.

1|Updated Jun 18, 2025
One-click install
npx skills add https://github.com/knopki/dotfiles --skill auth-implementation-patterns-knopki
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-implementation-patterns
Source: https://github.com/knopki/dotfiles/tree/main/home/private_dot_config/opencode/skills/auth-implementation-patterns
Command: npx skills add https://github.com/knopki/dotfiles --skill auth-implementation-patterns-knopki

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 addresses the complex challenge of implementing secure and scalable authentication and authorization systems, protecting user data and controlling access effectively.

Core Features & Use Cases

  • Authentication Strategies: Implement session-based, JWT-based, and OAuth2/OpenID Connect flows.
  • Authorization Models: Utilize Role-Based Access Control (RBAC) and permission-based checks.
  • Security Best Practices: Incorporate password hashing, rate limiting, and secure cookie management.
  • 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 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 in my API?

To implement JWT authentication in your API, use the provided TypeScript examples and the jsonwebtoken dependency to generate and verify tokens, ensuring secure stateless access control for your endpoints.

What is the difference between session-based and JWT authentication?

Session-based authentication uses express-session to store user state server-side, whereas JWT authentication issues stateless tokens to the client; this Skill provides guidance and code examples for implementing both secure API access patterns.

How do I set up Role-Based Access Control (RBAC) for my application?

You can set up Role-Based Access Control (RBAC) by implementing permission-based checks within your application logic, ensuring only users with specific roles like 'admin' can access protected API routes and resources.

Does this Skill support OAuth2 and OpenID Connect flows?

Yes, this Skill supports OAuth2 and OpenID Connect flows by utilizing the Passport dependency, allowing you to implement comprehensive authentication strategies and secure third-party access delegation in web applications.

What security best practices should I follow when implementing authorization?

When implementing authorization, you should incorporate password hashing with bcrypt, apply express-rate-limit to prevent brute-force attacks, and manage secure cookies to protect user data and control access effectively.

Can I use Passport for authentication strategies in a TypeScript environment?

Yes, you can use Passport for authentication strategies in a TypeScript environment, as this Skill provides comprehensive guidance and TypeScript examples for integrating session-based, JWT, and OAuth2 flows securely.