multiAI Summary Pending
auth-handler
Manage authentication, authorization, and user sessions. Use when dealing with login, sign-up, API protection, middleware, or user data fetching.
231 stars
Installation
Claude Code / Cursor / Codex
$curl -o ~/.claude/skills/auth-handler/SKILL.md --create-dirs "https://raw.githubusercontent.com/aiskillstore/marketplace/main/skills/aayushbaniya2006/auth-handler/SKILL.md"
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/auth-handler/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How auth-handler Compares
| Feature / Agent | auth-handler | Standard Approach |
|---|---|---|
| Platform Support | multi | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Manage authentication, authorization, and user sessions. Use when dealing with login, sign-up, API protection, middleware, or user data fetching.
Which AI agents support this skill?
This skill is compatible with multi.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Auth Handler
## Instructions
### 1. API Route Protection
- **Standard Routes**: Use `withAuthRequired`.
```typescript
export default withAuthRequired(async (req, { session, getUser }) => { ... })
```
- **Super Admin Routes**: Use `withSuperAdminAuthRequired`.
- **Cron Jobs**: Use `cronAuthRequired`.
- **Defense in Depth**: Do NOT rely solely on middleware. Always implement individual route protection.
### 2. Frontend Data Access
- **Client Components**: Use `useUser()` hook (SWR).
- **Restriction**: NEVER use `useSession` from `next-auth/react`.
### 3. Server-Side Data Access
- **Check Auth**: Import `auth` from `@/auth`.
- **Get Plan**: Use `getUserPlan(session.user.id)`. `session.user` is minimal.
## Reference
For architecture details, key files, and debugging tips, see [reference.md](reference.md).