This commit is contained in:
Timothy Jaeryang Baek
2025-04-05 04:05:52 -06:00
parent 0f310b3509
commit 0c0505e1cd
12 changed files with 613 additions and 368 deletions

View File

@@ -143,12 +143,14 @@ def create_api_key():
return f"sk-{key}"
def get_http_authorization_cred(auth_header: str):
def get_http_authorization_cred(auth_header: Optional[str]):
if not auth_header:
return None
try:
scheme, credentials = auth_header.split(" ")
return HTTPAuthorizationCredentials(scheme=scheme, credentials=credentials)
except Exception:
raise ValueError(ERROR_MESSAGES.INVALID_TOKEN)
return None
def get_current_user(