better-auth-python

Integrates Better Auth JWT verification into Python FastAPI backends.

Updated Dec 28, 2025
One-click install
npx skills add https://github.com/shuremali02/The-Evolution-of-Todo---Mastering-Spec-Driven-Development---Cloud-Native-AI --skill better-auth-python-shuremali02
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: better-auth-python
Source: https://github.com/shuremali02/The-Evolution-of-Todo---Mastering-Spec-Driven-Development---Cloud-Native-AI/tree/main/.claude/skills/better-auth-python
Command: npx skills add https://github.com/shuremali02/The-Evolution-of-Todo---Mastering-Spec-Driven-Development---Cloud-Native-AI --skill better-auth-python-shuremali02

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlines secure authentication for Python/FastAPI backends by integrating with the Better Auth TypeScript server to verify JWTs via JWKS, decode user claims, and protect routes.

Core Features & Use Cases

  • JWKS-based JWT verification in FastAPI applications.
  • Optional ORM integration with SQLModel or SQLAlchemy.
  • Reusable get_current_user dependency for protected endpoints.
  • Frontend integration with Better Auth to obtain and pass JWTs.

Quick Start

Install the required libraries, set BETTER_AUTH_URL, and wire the provided verify_token and get_current_user helpers into your FastAPI app to enable JWT-based authentication.

Frequently Asked Questions about better-auth-python

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

FAQPage Schema
How do I verify Better Auth JWTs in a FastAPI backend?

Verify Better Auth JWTs in FastAPI by fetching public keys from the Better Auth JWKS endpoint to validate tokens, decode user claims, and secure your protected routes using the provided get_current_user dependency.

How does JWKS-based JWT verification work with a Better Auth TypeScript server?

JWKS-based JWT verification fetches public keys from your Better Auth server endpoint to cryptographically validate token signatures, ensuring incoming FastAPI requests contain authentic decoded user claims without sharing secrets across services.

Can I use this JWT authentication dependency with SQLModel or SQLAlchemy?

Yes, this JWT authentication dependency supports optional ORM integration with both SQLModel and SQLAlchemy, providing ready-to-use sync and async database access for fetching user records on protected FastAPI endpoints.

What do I need to set up FastAPI route protection with Better Auth?

To set up FastAPI route protection with Better Auth, you need Python, FastAPI, PyJWT, and HTTPX installed, plus the BETTER_AUTH_URL environment variable configured to wire the verify_token helper into your application.

How do I pass Better Auth JWTs from my frontend to FastAPI protected endpoints?

Obtain JWTs from your frontend Better Auth integration and pass them in the authorization header to FastAPI protected endpoints, where the get_current_user dependency validates the token against JWKS before allowing route access.