wshobson avatar

Auth Implementation Patterns

This walks you through the messy realities of auth implementation with actual code patterns for JWT refresh flows, session management with Redis, OAuth2 integration, and RBAC systems. It covers the gotchas like token storage, logout mechanics, and permission checking that trip up most implementations. Use it when you're building login systems from scratch, debugging why tokens aren't refreshing properly, or trying to figure out the right auth strategy for your API. The examples are production-ready with proper error handling and security considerations baked in.

skills.sh installs
20.9K
GitHub stars
42.4K
last updated
Aug 21, 2026

Install

$ npx -y skills add wshobson/agents --skill auth-implementation-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

Authentication & Authorization Implementation Patterns

Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices.

When to Use This Skill

  • Implementing user authentication systems
  • Securing REST or GraphQL APIs
  • Adding OAuth2/social login
  • Implementing role-based access control (RBAC)
  • Designing session management
  • Migrating authentication systems
  • Debugging auth issues
  • Implementing SSO or multi-tenancy

Core Concepts

1. Authentication vs Authorization

Authentication (AuthN): Who are you?

  • Verifying identity (username/password, OAuth, biometrics)
  • Issuing credentials (sessions, tokens)
  • Managing login/logout

Authorization (AuthZ): What can you do?

  • Permission checking
  • Role-based access control (RBAC)
  • Resource ownership validation
  • Policy enforcement

2. Authentication Strategies

Session-Based:

  • Server stores session state
  • Session ID in cookie
  • Traditional, simple, stateful

Token-Based (JWT):

  • Stateless, self-contained
  • Scales horizontally
  • Can store claims

OAuth2/OpenID Connect:

Sponsors

Details

Repository
github.com/wshobson/agents
Categories
Backend & APIs, Security, DevOps & CI/CD, Debugging

More from wshobson/agents

All 174
1wshobson avatardotnet-backend-patternswshobson/agentsMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity19.6Kskills.sh installs
2google avatargemini-agents-apigoogle/skillsManages custom Agent resources on Gemini Enterprise Agent Platform. Use when the user wants to programmatically create, configure, list, update, or delete state10.4Kskills.sh installs
3anthropics avatarbuild-mcp-serveranthropics/claude-plugins-officialThis skill should be used when the user asks to "build an MCP server", "create an MCP", "make an MCP integration", "wrap an API for Claude", "expose tools to Cl7.4Kskills.sh installs
4jeffallan avatarwebsocket-engineerjeffallan/claude-skillsUse when building real-time communication systems with WebSockets or Socket.IO. Invoke for bidirectional messaging, horizontal scaling with Redis, presence trac7.1Kskills.sh installs
5payloadcms avatarpayloadpayloadcms/skillsUse when working with Payload projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, secur7.1Kskills.sh installs
6aws avataramazon-aurora-postgresqlaws/agent-toolkit-for-awsAmazon Aurora PostgreSQL — creates, modifies, and advises on Aurora PostgreSQL clusters specifically (PostgreSQL-compatible engine, Aurora serverless, express c6Kskills.sh installs