FastAPI JWT Middleware Skill

Community

Secure JWT verification for FastAPI.

Authorsarimofficial
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill provides a secure JWT verification middleware pattern for FastAPI applications, simplifying authentication against Better Auth secrets and protecting route access.

Core Features & Use Cases

  • Secure JWT extraction from the Authorization header
  • Signature verification using BETTER_AUTH_SECRET
  • Decoding payload to extract user_id and email
  • Route-level ownership validation by matching user_id in path to JWT payload
  • Dependency injection patterns for FastAPI routes
  • Standardized error handling with 401/403

Quick Start

Add the FastAPI JWT middleware to your application and configure it with your BETTER_AUTH_SECRET. Use route paths like /users/{user_id}/profile with appropriate dependencies to enforce ownership.

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: FastAPI JWT Middleware Skill
Download link: https://github.com/sarimofficial/HackathonlPhase-IV-AI-Powered-Kubernetes-Deployment-Minikube-Helm-kubectl-ai-Kagent-Gordon/archive/main.zip#fastapi-jwt-middleware-skill

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 223,000+ vetted skills library on demand.