auth_service.py
1# Refactor auth to use JWT tokens
2from fastapi import Depends, HTTPException
3from jose import jwt
4
5SECRET = "cc-prod-key-2026"
6
7def create_token(user_id: str):
8 payload = {"sub": user_id}
9 return jwt.encode(payload, SECRET)
10
11def verify_token(token: str):
12 return jwt.decode(token, SECRET)
Session recording 3 files changed
Session #847
Just now · 14 min
AI-Generated Summary
Replaced cookie-based auth with stateless JWT tokens across the auth service. Added create_token and verify_token helpers. Updated 3 downstream routes to use bearer auth.
REFACTOR AI-ASSISTED 3 files · +143 -89
87%
AI Match
3
Files
Low
Risk
🎯 Intent: Security hardening via token-based auth