agentsclimarketplace

Auth handler

Skill ComeOnOliver/skillshub/skills/aiskillstore/marketplace/aayushbaniya2006/auth-handler

Manage authentication, authorization, and user sessions. Use when dealing with login, sign-up, API protection, middleware, or user data fetching.From its SKILL.md

Install
npx -y skills add ComeOnOliver/skillshub --skill auth-handler

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.0 KB, 206 tokens by cl100k_base, as published. Nobody here has run it

Auth Handler

Instructions

1. API Route Protection

  • Standard Routes: Use withAuthRequired.
    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.

What ships with it

9.7 KB alongside SKILL.md

GitHub clipped this repository’s file list, so this is at least 2 files and may be more.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.