mirror of
https://github.com/cline/cline.git
synced 2026-09-21 13:21:23 +08:00
* fix: use vscode.env.asExternalUri for web OAuth callbacks In VS Code Web (Codespaces, code serve-web), OAuth callbacks using http://127.0.0.1:PORT break because the extension host runs remotely. Changes: - getCallbackUrl now accepts a path parameter - Desktop: uses vscode://extension-id/path directly - Web (UIKind.Web): uses vscode.env.asExternalUri() for web-reachable URL - Updated all callers (/auth, /openrouter, /hicap, /requesty, MCP) to pass path and use URL+searchParams for proper encoding - Added regression test asserting web callback URL is not 127.0.0.1 - AuthHandler (localhost HTTP) now only used by CLI/standalone mode * fix: use URL.searchParams for proper callback URL encoding Callers were using template literal interpolation to embed callback URLs into query strings, which breaks when the URL contains special characters (e.g. from asExternalUri with query params). Use URL+searchParams.set() which automatically encodes values. * chore: revert unrelated whitespace change in account.proto * revert: remove non-essential URL encoding changes in auth callers Keep only the core fix (getCallbackUrl path parameter + asExternalUri for web). Revert the URL+searchParams encoding improvement to minimize diff. * fix: URL-encode callback_url in auth callers, add encoding test In VS Code Web, callback URLs from asExternalUri can contain their own query params (?tkn=...&extra=...). String-interpolating them into callback_url= causes everything after the first & to be parsed as top-level params, truncating the callback URL. Use URL + searchParams.set() in openrouter, hicap, and requesty callers. Replace tautology test with deterministic round-trip encoding assertions.
570 B
570 B
cline
| cline |
|---|
| patch |
fix: use vscode.env.asExternalUri for auth callback URLs only in VS Code Web
Fixes OAuth callback redirect in VS Code Web (code serve-web, Codespaces) by using vscode.env.asExternalUri() to resolve the callback URI. This is gated behind a vscode.env.uiKind === UIKind.Web check so regular desktop VS Code continues to use the vscode:// URI directly. The getCallbackUrl API now accepts a path parameter so the full callback URI (including route) is resolved correctly, and callers pass their path directly instead of appending after.