mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix(proxy_server.py): return more detailed auth error message.
This commit is contained in:
parent
ffc6af0b22
commit
7b617e666d
1 changed files with 11 additions and 1 deletions
|
@ -1059,8 +1059,18 @@ async def user_api_key_auth(
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
user_role = "unknown"
|
||||||
|
user_id = "unknown"
|
||||||
|
if user_id_information is not None and isinstance(
|
||||||
|
user_id_information, list
|
||||||
|
):
|
||||||
|
_user = user_id_information[0]
|
||||||
|
user_role = _user.get("user_role", {}).get(
|
||||||
|
"user_role", "unknown"
|
||||||
|
)
|
||||||
|
user_id = _user.get("user_id", "unknown")
|
||||||
raise Exception(
|
raise Exception(
|
||||||
f"Only master key can be used to generate, delete, update info for new keys/users/teams. Route={route}"
|
f"Only proxy admin can be used to generate, delete, update info for new keys/users/teams. Route={route}. Your role={user_role}. Your user_id={user_id}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# check if token is from litellm-ui, litellm ui makes keys to allow users to login with sso. These keys can only be used for LiteLLM UI functions
|
# check if token is from litellm-ui, litellm ui makes keys to allow users to login with sso. These keys can only be used for LiteLLM UI functions
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue