auth-handler

Protect API routes and user sessions with authentication wrappers.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/alisonbessa/bluemoon --skill auth-handler
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth-handler
Source: https://github.com/alisonbessa/bluemoon/tree/main/.claude/skills/auth-handler
Command: npx skills add https://github.com/alisonbessa/bluemoon --skill auth-handler

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Authentication, authorization, and session management are essential for secure, scalable apps. This skill provides guidance on protecting API routes, guarding frontend data, and managing user sessions across server and client boundaries.

Core Features & Use Cases

  • Route protection: wrappers like withAuthRequired and withSuperAdminAuthRequired to secure standard and admin endpoints.
  • Cron and defense in depth: cronAuthRequired for scheduled tasks alongside middleware.
  • Data access patterns: server-side checks via an import from the auth module and frontend hooks like useUser() for safe user data access.

Quick Start

Wrap API routes with withAuthRequired to enforce authentication and protect resources.

Frequently Asked Questions about auth-handler

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I protect API routes and enforce user authentication in my app?

Protect API routes by wrapping them with the withAuthRequired wrapper, which enforces user authentication and secures standard endpoints before processing client-server data access requests.

What is the best way to secure admin endpoints and restrict access to super admins?

Secure admin endpoints using the withSuperAdminAuthRequired wrapper, which restricts route access to super admins. This ensures only authorized users interact with privileged server-side data and operations.

How do I manage user sessions across frontend and backend boundaries?

Manage user sessions safely by using the useUser frontend hook for client data access and importing server-side checks from the auth module. This maintains secure boundaries across API and UI layers.

How do I protect cron jobs and scheduled tasks from unauthorized access?

Protect scheduled tasks by applying the cronAuthRequired wrapper to your cron endpoints. This provides defense in depth alongside middleware, ensuring only authorized automated processes execute tasks.

How do I check user plans for authorization on the server side?

Check user plans for server-side authorization by using the getUserPlan function imported from the auth module. This validates access levels before returning restricted data to the client.

Do I need a specific auth module setup to use these route wrappers?

Yes, you need an existing auth module located at '@/auth'. The route wrappers and server-side checks depend on this specific import path to validate sessions and enforce authorization correctly.