OpenParable
Skip to content
← Back to skills

Auth And Authorization Patterns

Development
auth-and-authorization-patterns

Auth And Authorization Patterns is an Agent Skill for development published in the aiming-lab/MetaClaw repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

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.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/aiming-lab/MetaClaw/blob/HEAD/memory_data/skills/auth-and-authorization-patterns/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/auth-and-authorization-patterns, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

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.