Put back in validate_token that was foolishly dropped

This commit is contained in:
Khalim Conn-Kowlessar 2023-07-17 17:26:52 +01:00
parent 6f01e00c7e
commit f77ff1ec22

View file

@ -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