cleanup & log correct username in output

This commit is contained in:
Taylor Wilsdon
2025-08-12 18:19:24 -04:00
parent 31d902203e
commit 0cb802ee6f
2 changed files with 79 additions and 25 deletions

View File

@@ -203,6 +203,18 @@ class OAuthConfig:
if params.has_pkce:
return "oauth21"
# Additional detection: Check if we have an active OAuth 2.1 session
# This is important for tool calls where PKCE params aren't available
authenticated_user = request_params.get("authenticated_user")
if authenticated_user:
try:
from auth.oauth21_session_store import get_oauth21_session_store
store = get_oauth21_session_store()
if store.has_session(authenticated_user):
return "oauth21"
except Exception:
pass # Fall back to OAuth 2.0 if session check fails
# For public clients in OAuth 2.1 mode, we require PKCE
# But since they didn't send PKCE, fall back to OAuth 2.0
# This ensures backward compatibility