Skip to content

Commit

Permalink
fix: follow redirects added in fetch credential details api call
Browse files Browse the repository at this point in the history
  • Loading branch information
Charush committed Dec 24, 2024
1 parent b00afa5 commit 7777465
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion litellm/custom_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@

async def fetch_data(url: str):
async with httpx.AsyncClient() as client:
response = await client.get(url)
response = await client.get(
url,
headers={"Content-Type": "application/json"},
follow_redirects=True
)
return response


Expand Down Expand Up @@ -67,6 +71,7 @@ async def user_api_key_auth(request: Request, api_key: str) -> UserAPIKeyAuth:
# getting token details from authentication service
url = f"{budserve_app_baseurl}/credentials/details/{api_key.removeprefix('sk-')}"
credential_details_response = await fetch_data(url)
verbose_proxy_logger.debug(f"Credential details response >>> {credential_details_response}")
if credential_details_response.status_code != 200:
# No token was found when looking up in the DB
raise Exception("Invalid api key passed")
Expand Down
2 changes: 1 addition & 1 deletion litellm/proxy/budserve_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def fetch_user_config(self, api_key: str, endpoint_name: str):
try:
async with httpx.AsyncClient() as client:
response = await client.get(
url,
url,
params={"api_key": api_key, "endpoint_name": endpoint_name},
headers={"Content-Type": "application/json"},
follow_redirects=True
Expand Down

0 comments on commit 7777465

Please sign in to comment.