fix(claude-web): inject cf_clearance into cookie for 403 prevention (#3046)

The execute() and testConnection() methods called
normalizeClaudeSessionCookie() which does NOT inject cf_clearance.
Cloudflare pins cf_clearance to TLS fingerprint — without it, requests
get challenged with 403 even with valid session cookies.

Changed both call sites to use normalizeClaudeSessionCookieWithAutoRefresh()
which auto-injects cf_clearance via Turnstile solver when missing.

Fixes: [403]: Claude Web API error:

Co-authored-by: oyi77 <oyi77@users.noreply.github.com>
This commit is contained in:
Paijo
2026-06-02 04:14:39 +07:00
committed by GitHub
parent a1c743ddb0
commit 2a8954663c

View File

@@ -417,7 +417,7 @@ export class ClaudeWebExecutor extends BaseExecutor {
return false;
}
const cookieHeader = normalizeClaudeSessionCookie(rawCookie);
const cookieHeader = await normalizeClaudeSessionCookieWithAutoRefresh(rawCookie, { allowAutoSolve: false });
const deviceId = (credentials as any)?.deviceId as string | undefined;
return await verifyCookieValidity(cookieHeader, deviceId, signal);
@@ -479,7 +479,7 @@ export class ClaudeWebExecutor extends BaseExecutor {
};
}
const cookieHeader = normalizeClaudeSessionCookie(rawCookie);
const cookieHeader = await normalizeClaudeSessionCookieWithAutoRefresh(rawCookie, { log });
const deviceId = (credentials as any)?.deviceId as string | undefined;
// Transform request to Claude format