mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
(test) custom_auth bearer tokens
This commit is contained in:
parent
e6bc73d131
commit
1b4b5185bb
1 changed files with 7 additions and 1 deletions
|
|
@ -9,8 +9,14 @@ load_dotenv()
|
|||
async def user_api_key_auth(request: Request, api_key: str) -> UserAPIKeyAuth:
|
||||
try:
|
||||
print(f"api_key: {api_key}")
|
||||
if api_key == "":
|
||||
raise Exception(
|
||||
f"CustomAuth - Malformed API Key passed in. Ensure Key has `Bearer` prefix"
|
||||
)
|
||||
if api_key == f"{os.getenv('PROXY_MASTER_KEY')}-1234":
|
||||
return UserAPIKeyAuth(api_key=api_key)
|
||||
raise Exception
|
||||
except:
|
||||
except Exception as e:
|
||||
if len(str(e)) > 0:
|
||||
raise e
|
||||
raise Exception("Failed custom auth")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue