INNER CODE UNIT · Python

build_upstream

Kounex/obs_blade · tool/kick_auth_proxy/proxy.py:95

def build_upstream(form: dict[str, str]) -> dict[str, str]:
    """Return the form Kick should see, or raise ProxyError."""
    if not CLIENT_ID or not CLIENT_SECRET:
        raise ProxyError(500, "not_configured")
    grant = form.get("grant_type", "")
    if grant == "authorization_code":
        code = form.get("code", "")
        verifier = form.get("code_verifier", "")
        redirect = form.get("redirect_uri", "")
        if not code or not verifier:
            raise ProxyError(400, "invalid_request")
        if redirect not in ALLOWED_REDIRECTS:
            raise ProxyError(400, "invalid_redirect")
        if len(code) > 512 or len(verifier) > 256:
            raise ProxyError(400, "invalid_request")
        return {
            "grant_type": "authorization_code",
            "client_id": CLIENT_ID,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…