Authentication & Authorization Implementation Patterns

SkillSecurity

auth-implementation-patterns is a skill that guides an AI agent through designing and implementing authentication and authorization systems. It covers session-based, JWT, and OAuth2 strategies, plus RBAC and session management, along with secure practices like password hashing, short-lived tokens, secure cookies, rate limiting, and CSRF protection. It also lists common pitfalls, such as storing JWTs in localStorage and skipping server-side validation.

Use Authentication & Authorization Implementation Patterns in Claude, ChatGPT or Ahel Desktop

Free. Sign in, add Authentication & Authorization Implementation Patterns and connect your AI. About a minute.

Also: Claude Code · Cursor · Codex

Then ask your AI: use the Authentication & Authorization Implementation Patterns skill

Details

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Have an AI agent that can load skills and read files.

Authentication & Authorization Implementation PatternsStart free

What your AI can do with it

  • Implement session-based, JWT, and OAuth2/OpenID Connect authentication strategies
  • Design role-based access control (RBAC) and permission checking
  • Apply secure practices: bcrypt/argon2 hashing, short-lived tokens, secure cookies, CSRF
  • Add rate limiting to auth endpoints and log security events
  • Avoid common pitfalls like JWT in localStorage and client-side-only auth checks
  • Support tasks like securing REST or GraphQL APIs, adding social login, SSO

Getting started

  1. Have an AI agent that can load skills and read files.
  2. Add the auth-implementation-patterns skill to the agent's available skills.
  3. Ask the agent to implement or debug an auth system; it will use the skill when the task matches.
  4. For deeper patterns and worked examples, have the agent read the referenced details.md file.

What this skill tells your AI

The instructions your AI receives, as published by wshobson/agents in plugins/developer-essentials/skills/auth-implementation-patterns/SKILL.md and read by ahel’s review.

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:

  • Delegate authentication
  • Social login (Google, GitHub)
  • Enterprise SSO

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Never Store Plain Passwords: Always hash with bcrypt/argon2
  2. Use HTTPS: Encrypt data in transit
  3. Short-Lived Access Tokens: 15-30 minutes max
  4. Secure Cookies: httpOnly, secure, sameSite flags
  5. Validate All Input: Email format, password strength
  6. Rate Limit Auth Endpoints: Prevent brute force attacks
  7. Implement CSRF Protection: For session-based auth
  8. Rotate Secrets Regularly: JWT secrets, session secrets
  9. Log Security Events: Login attempts, failed auth
  10. Use MFA When Possible: Extra security layer

Common Pitfalls

  • Weak Passwords: Enforce strong password policies
  • JWT in localStorage: Vulnerable to XSS, use httpOnly cookies
  • No Token Expiration: Tokens should expire
  • Client-Side Auth Checks Only: Always validate server-side
  • Insecure Password Reset: Use secure tokens with expiration
  • No Rate Limiting: Vulnerable to brute force
  • Trusting Client Data: Always validate on server

Signals

GitHub stars
40k
Forks
4k
Last commit
Sep 2026

Questions

When should the agent use this skill?
When implementing user authentication, securing REST or GraphQL APIs, adding OAuth2 or social login, implementing RBAC, designing session management, migrating auth systems, debugging auth issues, or implementing SSO or multi-tenancy.
What authentication strategies does it cover?
Session-based auth (server-stored state with a session ID cookie), token-based JWT (stateless and self-contained), and OAuth2/OpenID Connect for delegated authentication, social login, and enterprise SSO.
Advanced
Item type
skill
Key
auth-implementation-patterns-wshobson
Source
github.com/wshobson/agents