auth-patterns

Implement JWT, OAuth, RBAC, and ABAC authentication patterns for backend services.

7|4|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/MadAppGang/magus --skill auth-patterns-madappgang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-patterns
Source: https://github.com/MadAppGang/magus/tree/main/plugins/dev/skills/backend/auth-patterns
Command: npx skills add https://github.com/MadAppGang/magus --skill auth-patterns-madappgang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides battle-tested patterns and code examples for implementing secure authentication and authorization mechanisms in backend services, protecting against common vulnerabilities.

Core Features & Use Cases

  • Authentication Methods: Covers JWT, session-based, and OAuth 2.0 flows.
  • Security Best Practices: Includes password hashing (bcrypt), MFA setup (TOTP), rate limiting, account lockout, and secure headers.
  • Authorization Models: Demonstrates Role-Based Access Control (RBAC) and Attribute-Based Access Control (ABAC).
  • Use Case: Secure a new user registration endpoint by implementing password hashing, email verification, and JWT-based session management.

Quick Start

Use the auth-patterns skill to generate JWT tokens for a user.

Frequently Asked Questions about auth-patterns

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

FAQPage Schema
How do I implement JWT-based session management in a backend service?

JWT-based session management is implemented by generating tokens upon user authentication and validating them on subsequent requests. This Skill provides patterns for securely generating JWT tokens, handling user registration, and managing email verification endpoints.

What is the difference between RBAC and ABAC for backend authorization?

RBAC (Role-Based Access Control) grants permissions based on user roles, while ABAC (Attribute-Based Access Control) evaluates user, resource, and environmental attributes. This Skill demonstrates both authorization models to help you choose the right access control pattern.

How does OAuth 2.0 work for backend authentication?

OAuth 2.0 for backend authentication works by delegating authorization to an external provider through secure flows. This Skill covers implementing OAuth 2.0 flows alongside JWT and session-based authentication methods to protect user data.

What's the best way to secure user passwords with bcrypt?

Securing user passwords with bcrypt involves hashing passwords before storage to protect against breaches. This Skill provides code examples for bcrypt password hashing, multi-factor authentication (TOTP), and securing new user registration endpoints.

How do I prevent brute force attacks with rate limiting and account lockout?

Rate limiting and account lockout prevent brute force attacks by restricting request frequency and disabling access after repeated failures. This Skill includes security best practices for implementing these mechanisms alongside secure headers.