fix: remove HTTPAuthCredentials import (FastAPI compatibility)
This commit is contained in:
@@ -6,7 +6,7 @@ import os
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from typing import Optional
|
||||
from fastapi import Depends, HTTPException, status
|
||||
from fastapi.security import HTTPBearer, HTTPAuthCredentials
|
||||
from fastapi.security import HTTPBearer
|
||||
from jose import JWTError, jwt
|
||||
from pydantic import BaseModel
|
||||
|
||||
@@ -58,7 +58,7 @@ def create_access_token(user_id: int, username: str, role: str, expires_delta: O
|
||||
return encoded_jwt
|
||||
|
||||
|
||||
async def get_current_user(credentials: HTTPAuthCredentials = Depends(security)):
|
||||
async def get_current_user(credentials = Depends(security)):
|
||||
"""
|
||||
Dependency that validates JWT token from Authorization header.
|
||||
Returns TokenData with user_id, username, role.
|
||||
|
||||
Reference in New Issue
Block a user