Skills · Coding

Authentication & Authorization Implementation Patterns

Unverified30/40

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.

Originally by wshobson · MIT

Claude CodePartialHas SKILL.md but declares no allowed-tools — Claude Code will ask for permission each time
CursorPartialPlain prose you can paste in — but no Cursor rules file
CodexPartialPlain prose you can paste in — but no AGENTS.md
Gemini CLIPartialPlain prose you can paste in
CopilotPartialPlain prose you can paste in — but no Copilot instructions file
npx agentalley add auth-implementation-patterns

This command does not work yet — the CLI is still being built. Until then, use Raw in the reader below to take the file.

Who is stuck, and on what

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.

The whole source

No sign-in, no blur, nothing truncated
auth-implementation-patterns/SKILL.md84 lines2.6 KBRawView on GitHub
Frontmatter — 2 properties
nameauth-implementation-patterns
descriptionMaster authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.
1---
2name: auth-implementation-patterns
3description: Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.
4---A5No allowed-tools declared — no way to tell what this skill may touch
5 
6# Authentication & Authorization Implementation Patterns
7 
8Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices.
9 
10## When to Use This Skill
11 
12- Implementing user authentication systems
13- Securing REST or GraphQL APIs
14- Adding OAuth2/social login
15- Implementing role-based access control (RBAC)
16- Designing session management
17- Migrating authentication systems
18- Debugging auth issues
19- Implementing SSO or multi-tenancy
20 
21## Core Concepts
22 
23### 1. Authentication vs Authorization
24 
25**Authentication (AuthN)**: Who are you?
26 
27- Verifying identity (username/password, OAuth, biometrics)
28- Issuing credentials (sessions, tokens)
29- Managing login/logout
30 
31**Authorization (AuthZ)**: What can you do?
32 
33- Permission checking
34- Role-based access control (RBAC)
35- Resource ownership validation
36- Policy enforcement
37 
38### 2. Authentication Strategies
39 
40**Session-Based:**
41 
42- Server stores session state
43- Session ID in cookie
44- Traditional, simple, stateful
45 
46**Token-Based (JWT):**
47 
48- Stateless, self-contained
49- Scales horizontally
50- Can store claims
51 
52**OAuth2/OpenID Connect:**
53 
54- Delegate authentication
55- Social login (Google, GitHub)
56- Enterprise SSO
57 
58## Detailed patterns and worked examples
59 
60Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
61 
62## Best Practices
63 
641. **Never Store Plain Passwords**: Always hash with bcrypt/argon2
652. **Use HTTPS**: Encrypt data in transit
663. **Short-Lived Access Tokens**: 15-30 minutes max
674. **Secure Cookies**: httpOnly, secure, sameSite flags
685. **Validate All Input**: Email format, password strength
696. **Rate Limit Auth Endpoints**: Prevent brute force attacks
707. **Implement CSRF Protection**: For session-based auth
718. **Rotate Secrets Regularly**: JWT secrets, session secrets
729. **Log Security Events**: Login attempts, failed auth
7310. **Use MFA When Possible**: Extra security layer
74 
75## Common Pitfalls
76 
77- **Weak Passwords**: Enforce strong password policies
78- **JWT in localStorage**: Vulnerable to XSS, use httpOnly cookies
79- **No Token Expiration**: Tokens should expire
80- **Client-Side Auth Checks Only**: Always validate server-side
81- **Insecure Password Reset**: Use secure tokens with expiration
82- **No Rate Limiting**: Vulnerable to brute force
83- **Trusting Client Data**: Always validate on server
84 

Reviews

Installed this one?Write the first review and take the Trailblazer badge.

Reviews only open after a real install, so this is empty — and we leave it empty rather than invent one.

Alternatives

Also in Coding