Agent skill · software engineering · aiskillstore

jwt-auth

Use when implementing JWT authentication in FastAPI or Python projects. Triggers for: token generation, verification middleware, current user extraction, access token creation, token decoding, or role-based auth. NOT for: OAuth2 provider setup, OpenID Connect, or non-Python backends.

Why this skill is useful

Provides specific implementation patterns for JWT authentication in FastAPI, including token generation and role-based access control that the AI wouldn't reliably generate on its own.

What it needs

About 2k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

JWT Authentication Skill Expert implementation of JWT token generation, verification, and user extraction for FastAPI and Python applications. Quick Reference Operation Function Location ----------- ---------- ---------- Generate token createaccesstoken(data, expiresdelta=None) auth/jwt.py Verify token verifytoken(token: str) auth/dependencies.py Get current user getcurrentuser(token: str) auth/dependencies.py User from payload User.frompayload(payload) auth/dependencies.py Core Workflows 1. Generate Access Token Claims structure: sub (required): User identifier (email, ID, or username) exp (auto): Expiration time roles (optional): List of role strings for authorization Custom claims: Add any extra data as needed 2. Protect Endpoint with Dependency 3. Role-Based Access Control 4. Extract User from JWT Payload Security Checklist [ ] Short expiry + refresh: Access tokens expire in 15-30 minutes; implement refresh token flow for long sessions [ ] No sensitive data: Never put passwords, PII, or secrets in JWT claims [ ] Blacklist invalid: Implement token blacklist for logout (see revokedtokens set) [ ] HS256 algorithm: Use HMAC-SHA256; never use algorithm="none" [ ] Verify expiration: Always check exp claim; reject expired tokens Token Structure User Model Integration with @auth-integration Frontend The backend JWT implementation pairs with the frontend auth integration skill: 1. Backend: auth/jwt.py and auth/dependencies.py 2. Frontend: Use auth-integration skill for React/Next.js auth context 3. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/jwt-auth

View the source on GitHub

Browse the @skills marketplace