trinhhaox/ag-kit/authentication
Claude Code and agent skill by trinhhaox/ag-kit
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Authentication patterns - JWT, sessions, OAuth 2.0/OIDC, passkeys, RBAC, MFA. Token rotation, password hashing, rate limiting.
Install
npx vskill@latest install trinhhaox/ag-kit/authenticationSKILL.md
Authentication Patterns
Production auth patterns covering tokens, sessions, OAuth, and access control.
Token-Based (JWT)
Token Strategy
| Token | Lifetime | Storage | Purpose | |
|---|---|---|---|---|
| Access token | 15 min | Memory/cookie | API authorization | |
| Refresh token | 7 days | httpOnly cookie | Token renewal | |
| ID token | 15 min | Memory | User identity (OIDC) |
JWT Best Practices
Token Rotation
Session-Based
Setup
Session Store
- Redis for distributed systems (TTL = session lifetime)
- Database for audit requirements
- Regenerate session ID on privilege change (login, role change)
OAuth 2.0 / OIDC
Authorization Code Flow (with PKCE)
Provider Integration
Password Hashing
Recommended Algorithms
| Algorithm | Config | Use When | |
|---|---|---|---|
| Argon2id | memory=64MB, iterations=3, parallelism=4 | Default choice | |
| bcrypt | cost ≥ 12 | Legacy systems, wider library support | |
| scrypt | N=2^17, r=8, p=1 | Alternative to Argon2 |
Never: MD5, SHA-1, SHA-256 alone, unsalted hashes
RBAC (Role-Based Access Control)
Permission Model
Middleware Pattern
MFA (Multi-Factor Authentication)
TOTP (Time-Based One-Time Password)
Backup Codes
- Generate 10 single-use codes at MFA setup
- Hash and store them (like passwords)
- Mark as used after consumption
Rate Limiting
Auth Endpoints
| Endpoint | Limit | Window | Action on Exceed | |
|---|---|---|---|---|
| POST /login | 5 attempts | 15 min | Lock + email alert | |
| POST /register | 3 attempts | 1 hour | CAPTCHA | |
| POST /forgot-password | 3 attempts | 1 hour | Silent (no error leak) | |
| POST /verify-mfa | 5 attempts | 5 min | Session invalidation |
Implementation
Security Checklist
- [ ] Tokens in httpOnly, Secure, SameSite cookies
- [ ] CSRF protection (state parameter, double-submit cookie)
- [ ] Password hashing with Argon2id or bcrypt (cost ≥ 12)
- [ ] Rate limiting on all auth endpoints
- [ ] Session regeneration on privilege change
- [ ] Refresh token rotation (single-use)
- [ ] Secrets from environment variables only
- [ ] No sensitive data in JWT payload (use opaque tokens if needed)
- [ ] Audit logging for login, logout, password change, MFA events
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/authentication/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/trinhhaox/ag-kit/authentication)