auth-package

Community

Secure React and Fastify routes with Auth0.

Authormattbutlerengineering
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This skill solves the complexity of adding OIDC-based authentication to a React frontend and protecting Fastify API routes using a consistent, portable @mbe/auth layer.

Core Features & Use Cases

  • React AuthProvider + hooks: Initialize authentication state with AuthProvider and manage sign-in, sign-out, and session-aware UI using useAuth, useAccessToken, and useRequireAuth.
  • Fastify JWT protection: Register authPlugin to validate bearer JWTs and populate request.user, or apply requireAuth per-route for fine-grained access control.
  • Environment-driven configuration for Auth0: Configure authority, clientId, redirectUri, and audience via Vite and Node environment variables, aligned to an Auth0 OIDC setup.
  • Testing patterns (unit + E2E): Mock useAuth in Vitest for deterministic component testing and use Playwright with programmatic Auth0 login fixtures for authenticated E2E flows.

Quick Start

Use this skill to add authentication by wrapping your React app with AuthProvider, then protect Fastify routes by registering authPlugin and adding requireAuth where needed.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: auth-package
Download link: https://github.com/mattbutlerengineering/mattbutlerengineering/archive/main.zip#auth-package

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.