diff --git a/backend/app/dependencies.py b/backend/app/dependencies.py index 07fa3c00..45650d1f 100644 --- a/backend/app/dependencies.py +++ b/backend/app/dependencies.py @@ -94,3 +94,12 @@ def validate_jwt_token(token: str = Depends(oauth2_scheme)): except JWTError: logger.error("An error occurred while decoding the JWT token.") raise credentials_exception + + +async def validate_token(token: str = Depends(oauth2_scheme), request: Request = None): + token_data = validate_jwt_token(token) + if not token_data: + raise HTTPException( + status_code=status.HTTP_403_FORBIDDEN, detail="Could not validate credentials" + ) + return token