5,469,219 AI resources indexedWorking toward the world’s largest AI resource index.

PDF

Auth & Authorization Patterns

Use this skill when implementing authentication (login, token issuance) or authorization (access control, permissions). Apply whenever the task involves login flows, JWT, OAuth2, session management, or RBAC.

Installable skillMITBy aiming-labUpdated Oct 30, 2026
INTENDED FORClaude CodeCodexOpenClawCursorGeminiInstall in a listed agent.

instructions.md

---
name: auth-and-authorization-patterns-94970a377169
description: Use this skill when implementing authentication (login, token issuance) or authorization (access control, permissions). Apply whenever the task involves login flows, JWT, OAuth2, session management, or RBAC.
category: security
---

# Auth & Authorization Patterns

**Authentication (who are you?):**
- Use a battle-tested library — do not roll your own crypto.
- Hash passwords with bcrypt/argon2; never MD5/SHA1 for passwords.
- Use short-lived JWTs (15–60 min) with refresh tokens; store refresh tokens securely.
- Implement MFA for sensitive operations.

**Authorization (what can you do?):**
- Check authorization on every request, not just at login.
- Enforce RBAC or ABAC at the service layer, not the UI.
- Apply principle of least privilege: grant minimal permissions needed.

**OAuth2 / OIDC:**
- Use the Authorization Code flow with PKCE for user-facing apps.
- Validate `iss`, `aud`, `exp`, and `nonce` claims on every token.

**Session management:**
- Regenerate session ID after login (session fixation prevention).
- Set `HttpOnly` and `Secure` flags on session cookies.

Discuss this resource

Platform guidance

Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.