authentication-patterns
Skill0 starsChanged 8 months agoMITView on GitHub
Use when implementing auth - OAuth 2.0, JWT, session management, API keys, RBAC, or reviewing auth security
5 other projects use a version of this.
Adopted by
Most recently taken up by
- codecharmhq/claude-code-skillstheir own version, first seen May 17, 2026
- valentinesamuel/claude-skillstheir own version, first seen Apr 19, 2026
- travisjneuman/.claudetheir own version, first seen Feb 25, 2026
- zebbern/claude-code-guidetheir own version, first seen Feb 8, 2026
- rohitg00/awesome-claude-code-toolkittheir own version, first seen Feb 4, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- zebbern/claude-code-guide★ 4.6ksame name
- rohitg00/awesome-claude-code-toolkit★ 2.7ksame name
- travisjneuman/.claude★ 101same name
- codecharmhq/claude-code-skills★ 1same name
- valentinesamuel/claude-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository190 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- accessibility-auditSkill
- accessibility-complianceSkill
- ado-api-cliSkill
- ado-artifactsSkill
- ado-container-deploymentsSkill
- ado-organizationSkill
- ado-pipeline-designSkill
- ado-pipeline-optimizationSkill
- ado-pipeline-securitySkill
- ado-pipelines-opsSkill
- ado-release-managementSkill
- ado-security-policiesSkill
- ado-work-trackingSkill
- adr-writingSkill
- agentic-ai-patternsSkill
- agentic-evalSkill
- agentic-memorySkill
- agentic-reliabilitySkill
- agentic-securitySkill
- ai-data-moatSkill
- ai-harnessSkill
- ai-product-designSkill
- ai-product-monetizationSkill
- ai-product-positioningSkill
- ai-product-retentionSkill
- ai-product-validationSkill
- ai-safety-guardrailsSkill
- add-analytics-instrumentationSkill
- analyze-account-healthSkill
- analyze-ai-topicsSkill
- analyze-chartSkill
- analyze-dashboardSkill
- analyze-experimentSkill
- analyze-feedbackSkill
- compare-user-journeysSkill
- create-chartSkill
- create-dashboardSkill
- daily-briefSkill
- debug-replaySkill
- diagnose-errorsSkill
- diff-intakeSkill
- discover-analytics-patternsSkill
- discover-event-surfacesSkill
- discover-opportunitiesSkill
- instrument-eventsSkill
- investigate-ai-sessionSkill
- monitor-ai-qualitySkill
- monitor-reliabilitySkill
- replay-ux-auditSkill
- review-agent-insightsSkill
- taxonomySkill
- weekly-briefSkill
- what-would-lenny-doSkill
- analytics-reportingSkill
- api-contract-testingSkill
- api-designSkill
- blockchain-auditSkill
- brainstormingSkill
- brand-voiceSkill
- The first 60 shown.
The file
Files
Authentication Patterns
Overview
Auth is the most security-critical part of any application. Use proven patterns, never roll your own crypto.
When to Use
- Implementing login/signup flows
- Adding OAuth/social login
- Designing API authentication
- Reviewing auth security
- Implementing role-based access control
Pattern Selection
| Pattern | Best For | Avoid When |
| Session + cookie | Server-rendered web apps | Mobile/SPA without same-origin |
| JWT (access + refresh) | SPAs, mobile apps, microservices | Simple server-rendered apps |
| OAuth 2.0 + OIDC | Social login, SSO, third-party auth | Internal-only tools |
| API keys | Server-to-server, public APIs | User-facing auth |
JWT Best Practices
- Short-lived access tokens — 15 minutes max
- Long-lived refresh tokens — stored in httpOnly cookie, rotated on use
- Never store JWTs in localStorage — XSS vulnerable
- Include minimal claims — user ID, roles. Not PII.
- Validate on every request — check signature, expiry, issuer
- Use RS256 or ES256 — not HS256 for distributed systems
OAuth 2.0 Flow (Authorization Code + PKCE)
1. Client generates code_verifier + code_challenge
2. Redirect to /authorize?response_type=code&code_challenge=...
3. User authenticates with provider
4. Provider redirects back with authorization code
5. Client exchanges code + code_verifier for tokens
6. Store access token in memory, refresh token in httpOnly cookieSecurity Checklist
- Passwords hashed with bcrypt/argon2 (cost factor ≥12)
- Rate limiting on login endpoints
- Account lockout after N failed attempts
- CSRF protection on session-based auth
- Refresh token rotation (one-time use)
- Secure cookie flags:
httpOnly,secure,sameSite=strict - No secrets in JWTs or URLs
Integration
- magic-powers:api-design — auth headers and error responses
- magic-powers:security-review — audit auth implementation
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

