auth-flow

auth-flow is a command for Claude Code from sairam0424/MindForge. It costs 39 tokens per session (1,047 once invoked), scanned A, original, MIT.

An authentication and authorization flow designer. Authentication checks who a user is; authorization decides what that user may do.

In plain words
What is it for?
It helps design OAuth2 with PKCE, server sessions, or JWT-based API access, including token lifecycles, validation, revocation, and role- or attribute-based permissions.
Why use it?
It helps prevent common mistakes in login, token storage, logout, and permission handling across different application types.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/sairam0424/mindforge/auth-flow
Clone the repo
git clone --depth 1 https://github.com/sairam0424/MindForge

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for auth-flow

README.md
[![agentmods](https://agentmods.dev/badge/commands/sairam0424/mindforge/auth-flow.svg)](https://agentmods.dev/commands/sairam0424/mindforge/auth-flow)
Your own site
<a href="https://agentmods.dev/commands/sairam0424/mindforge/auth-flow"><img src="https://agentmods.dev/badge/commands/sairam0424/mindforge/auth-flow.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,047 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00039 $0.01047
Opus 5 $0.00019 $0.00524
Sonnet 5 $0.00008 $0.00209
Haiku 4.5 $0.00004 $0.00105

Measured yesterday against content hash 7fa4d95ec734, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

auth-flow scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/mindforge/auth-flow.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.

<execution_context> @.mindforge/skills/auth-patterns/SKILL.md </execution_context>

  1. Select authn flow: Based on --type flag or client analysis:

    • OAuth2 + PKCE (for SPAs/mobile): Authorization Code flow with PKCE, no client secret exposed
    • Session-based (for server-rendered): HTTP-only secure cookies, server-side session store
    • JWT (for APIs/microservices): Signed tokens with short expiry, refresh token rotation
    • For each: document the full flow (request → redirect → callback → token → validation)
    • Specify token storage location (httpOnly cookie, secure storage, never localStorage)
    • Define logout mechanism (token revocation, session invalidation, cookie clearing)
  2. Design token lifecycle: Define the token management:

    • Access token: short-lived (15 min), contains minimal claims (sub, scope, exp)
    • Refresh token: longer-lived (7 days), rotated on each use (detect theft via reuse)
    • ID token: user profile claims, validated once at login
    • Token revocation: maintain revocation list or use short expiry + refresh
    • Token validation: signature check → expiry check → issuer check → audience check
    • Clock skew tolerance: 30 seconds maximum
  3. Add MFA if needed: When --mfa flag is set:

    • Primary factors: password (argon2id hash), social login (OAuth2)
    • Second factors: TOTP (authenticator app), WebAuthn (hardware key), SMS (fallback only)
    • Step-up auth: require MFA for sensitive operations (password change, payment, admin)
    • Recovery: backup codes (10 single-use), admin override with audit log
    • Enrollment flow: optional at signup, required for admin/elevated roles
    • Remember device: trust for 30 days with device fingerprint
  4. Design authz model: Based on --authz flag:

    • RBAC (Role-Based): Define roles (admin, editor, viewer) → map to permissions → assign to users
    • ABAC (Attribute-Based): Define policies based on subject attributes, resource attributes, action, and context
    • Permission granularity: resource-level (can edit ANY post) vs instance-level (can edit OWN posts)
    • Inheritance: role hierarchy (admin inherits editor permissions)
    • Deny-by-default: all access denied unless explicitly granted
    • Policy evaluation: eager (at login, cache in token) vs lazy (at access time, check service)
    • Group-based: assign roles to groups, users inherit from groups
  5. Implement: Translate design to code:

    • Auth middleware: validate token on every request, attach user context
    • Permission check: decorator/middleware pattern at route or controller level
    • Service-to-service: mutual TLS or signed JWT with service identity
    • Rate limiting: per-user and per-IP on auth endpoints (prevent brute force)
    • Audit logging: log every auth event (login, logout, failure, permission denied, MFA challenge)
    • Error responses: generic messages (never reveal "user not found" vs "wrong password")
  6. Audit: Validate the auth implementation:

    • OWASP Authentication Cheat Sheet compliance
    • Session fixation protection (regenerate session ID on login)
    • CSRF protection on state-changing endpoints (SameSite cookies + CSRF token)
    • Credential stuffing protection (rate limiting, CAPTCHA after N failures)
    • Token leakage vectors (URL parameters, referrer headers, logs)
    • Privilege escalation paths (horizontal: access other user data, vertical: gain admin)
    • Output: security assessment report with findings and remediation

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 77 lines · 39 tokens per session scan A 7fa4d95ec734

Subscribe to this mod's changes

auth-flow is a command published in the GitHub repository sairam0424/MindForge (0 stars, last pushed yesterday), licensed MIT. It adds 39 tokens to every session and 1,047 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.