Refactor and enhance token decoding error handling

Improved the `decode_token` function to clarify and extend error handling for token validation and decoding. Enhanced error messages for invalid tokens, added checks for missing claims, and ensured clear differentiation of failure scenarios. Updated imports and added a `scope` field to token response for completeness.
This commit is contained in:
2025-02-28 19:05:08 +01:00
parent 0bc9263d24
commit 453016629f
6 changed files with 93 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ uvicorn>=0.34.0
pydantic>=2.10.6
pydantic-settings>=2.2.1
python-multipart>=0.0.19
fastapi-utils==0.8.0
# Database
sqlalchemy>=2.0.29
@@ -30,7 +31,7 @@ httpx>=0.27.0
tenacity>=8.2.3
pytz>=2024.1
pillow>=10.3.0
apscheduler==3.11.0
# Testing
pytest>=8.0.0
pytest-asyncio>=0.23.5
@@ -47,4 +48,5 @@ mypy>=1.8.0
python-jose==3.4.0
bcrypt==4.2.1
cryptography==44.0.1
passlib==1.7.4
passlib==1.7.4
freezegun~=1.5.1