auth

Implement JWT authentication across FastAPI and Next.js with token refresh.

Updated Dec 14, 2025
One-click install
npx skills add https://github.com/toobutta/maptelli --skill auth-toobutta
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auth
Source: https://github.com/toobutta/maptelli/tree/main/.claude/skills/auth
Command: npx skills add https://github.com/toobutta/maptelli --skill auth-toobutta

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Skill provides a complete JWT-based authentication solution across the Maptelli stack, replacing hardcoded user IDs with real token verification for secure user sessions.

Core Features & Use Cases

  • Backend user model, password hashing, and OAuth2-style token endpoints (register, login, refresh, me).
  • Frontend state management with a persistent user store, token refresh interceptor, and route guards to protect protected pages.
  • Real-world use: a new user signs up, logs in, and seamlessly accesses protected features with refresh tokens and guarded routes.

Quick Start

Run the full stack locally to verify registration, login, token refresh, and protected routes.

Frequently Asked Questions about auth

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

FAQPage Schema
How do I implement JWT authentication with FastAPI and Next.js?

JWT authentication with FastAPI and Next.js is implemented here through backend token endpoints, a persistent Zustand user store, and Axios interceptors for seamless token refresh. It covers registration, login, and protected route guards across the full stack.

What's the best way to set up a token refresh flow using Axios and Zustand?

The token refresh flow uses an Axios interceptor to automatically request new access tokens and a persistent Zustand store to manage user state. Short-lived access tokens are paired with longer-lived refresh tokens for secure sessions.

Do I need python-jose to enforce short access tokens with FastAPI?

Yes, this implementation leverages python-jose for token signing and verification. It specifically enforces short access tokens paired with longer-lived refresh tokens to secure gated resources and protected routes.

How does frontend route guarding work with JWT tokens?

Frontend route guarding uses a persistent Zustand store to track user authentication state and block access to protected pages. It pairs with Axios interceptors to ensure tokens are valid and refreshed when accessing gated resources.

Can I use this JWT authentication solution for a full-stack Maptelli application?

Yes, this solution targets full-stack teams building secure user authentication flows specifically for the Maptelli stack. It replaces hardcoded user IDs with real token verification across FastAPI backends and Next.js frontends.