# /auth-system - Authentication & Role-Based Access System

> OAuth 2.0, session cookies, multi-tenant RBAC, and middleware protection.

Canonical: https://www.agentickit.co/commands/auth-system
Last updated: 2026-11-18

Implements secure authentication and authorization: OAuth logins (Google/GitHub), session management, password hashing, and role-based route middleware.

**Usage:** `Use when setting up login systems, multi-tenant workspace permissions, or protected routes.`

## Pipeline
1. Configure authentication provider and session token cookies
2. Set up user credentials and OAuth account database tables
3. Write Next.js edge middleware protecting authenticated routes
4. Add workspace membership roles (Owner, Admin, Member) and permission guards

## Output files
- `src/middleware.ts`
- `src/lib/auth.ts`
- `src/app/api/auth/...`

**Claude Code frontmatter:** `argument-hint: [auth provider or flow, e.g. Clerk with orgs]` · `model: inherit`

## Related
- [security-auditor](https://www.agentickit.co/agents/security-auditor)
- [api-engineer](https://www.agentickit.co/agents/api-engineer)
- [backend-architect](https://www.agentickit.co/agents/backend-architect)
- [auth-patterns](https://www.agentickit.co/skills/auth-patterns)
- [oauth-integrations](https://www.agentickit.co/skills/oauth-integrations)
- [security-basics](https://www.agentickit.co/skills/security-basics)
