attempt to fix auth

This commit is contained in:
saidsurucu
2025-07-02 02:17:37 +03:00
parent 7e6819affa
commit cb6d6ee8df
7 changed files with 289 additions and 799 deletions
+7
View File
@@ -191,6 +191,13 @@ class OAuthProvider:
"scope": " ".join(session["scopes"]),
}
def validate_pkce(self, code_verifier: str, code_challenge: str) -> bool:
"""Validate PKCE code challenge (RFC 7636)"""
# S256 method
verifier_hash = hashlib.sha256(code_verifier.encode()).digest()
expected_challenge = base64.urlsafe_b64encode(verifier_hash).decode().rstrip('=')
return expected_challenge == code_challenge
def _create_mcp_token(
self, scopes: list[str], upstream_token: str, session_id: str
) -> str: