Publish Python 3.13 FastAPI JWT Bcrypt Fix Guide
Browse files
README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- fastapi
|
| 5 |
+
- python-3.13
|
| 6 |
+
- bcrypt
|
| 7 |
+
- passlib
|
| 8 |
+
- jwt-authentication
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# 🛡️ Fixing `ValueError: password cannot be longer than 72 bytes` in Python 3.12 / 3.13 (`passlib` + `bcrypt`)
|
| 12 |
+
|
| 13 |
+
[](https://yahiaoui26.gumroad.com/l/fastapi-gemini-blueprint)
|
| 14 |
+
[](https://yahiaoui26.gumroad.com/l/shipai-pro/BLUEPRINT30)
|
| 15 |
+
|
| 16 |
+
When deploying **FastAPI** authentication routes using `passlib[bcrypt]` on **Python 3.12 or Python 3.13**, newer versions of `bcrypt` (`>= 4.1.0`) raise:
|
| 17 |
+
```text
|
| 18 |
+
ValueError: password cannot be longer than 72 bytes, truncate manually if necessary
|
| 19 |
+
```
|
| 20 |
+
during `passlib`'s internal `detect_wrap_bug` startup check.
|
| 21 |
+
|
| 22 |
+
## ✅ The Instant Production Fix
|
| 23 |
+
|
| 24 |
+
Pin `bcrypt==4.0.1` alongside `passlib[bcrypt]` in your `requirements.txt`:
|
| 25 |
+
|
| 26 |
+
```txt
|
| 27 |
+
fastapi
|
| 28 |
+
uvicorn
|
| 29 |
+
passlib[bcrypt]
|
| 30 |
+
bcrypt==4.0.1
|
| 31 |
+
python-jose[cryptography]
|
| 32 |
+
pydantic[email]
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## 🎁 Building a FastAPI + AI Micro-SaaS in 2026?
|
| 38 |
+
|
| 39 |
+
Don't waste 30+ hours debugging Python 3.13 auth, JWT bearer guards, SaaS user credit quotas, and Google Gemini structured JSON outputs from scratch:
|
| 40 |
+
|
| 41 |
+
* 📘 **[Download the Free 2026 FastAPI + Gemini Architecture Blueprint ($0)](https://yahiaoui26.gumroad.com/l/fastapi-gemini-blueprint)**
|
| 42 |
+
* 🚀 **[Get ShipAI v2.0 Commercial Micro-SaaS Boilerplate (30% OFF with code `BLUEPRINT30`)](https://yahiaoui26.gumroad.com/l/shipai-pro/BLUEPRINT30)**
|