add fix to auth error

This commit is contained in:
AlexSze 2026-04-24 17:49:53 +08:00
parent 7b47dffefd
commit 0586d83c16

View file

@ -1308,6 +1308,14 @@ async def auth_callback(request: Request, state: Optional[str] = None): # noqa:
"""Verify login"""
verbose_proxy_logger.info(f"Starting SSO callback with state: {state}")
oauth_error = request.query_params.get("error")
oauth_error_description = request.query_params.get("error_description")
if oauth_error:
raise HTTPException(
status_code=401,
detail=f"OAuth error: {oauth_error}, error_description: {oauth_error_description}",
)
# Check if this is a CLI login (state starts with our CLI prefix)
from litellm.constants import LITELLM_CLI_SESSION_TOKEN_PREFIX
from litellm.proxy._types import LiteLLM_JWTAuth