jackwener/OpenCLI · error · AuthRequiredError('web.okjike.com')
${outcome?.detail || `${label} returned HTTP ${outcome?.stat
Error message
${outcome?.detail || `${label} returned HTTP ${outcome?.status}`} What it means
AuthRequiredError for web.okjike.com thrown by postJikeApi when the POST outcome indicates auth failure: the probe returned kind 'auth' (missing JK_ACCESS_TOKEN) or the API responded with HTTP 401/403. The detail message is the probe detail, or falls back to '<label> returned HTTP <status>'.
Source
Thrown at clis/jike/utils.js:76
const response = await fetch(${JSON.stringify(url)}, {
method: 'POST',
credentials: 'include',
headers,
body: JSON.stringify(${JSON.stringify(requestBody)}),
});
let body;
try {
body = await response.json();
} catch (error) {
return { kind: 'json', status: response.status, detail: String(error?.message || error) };
}
return { kind: 'response', status: response.status, body };
} catch (error) {
return { kind: 'transport', detail: String(error?.message || error) };
}
})()`);
if (outcome?.kind === 'auth' || outcome?.status === 401 || outcome?.status === 403) {
throw new AuthRequiredError('web.okjike.com', outcome?.detail || `${label} returned HTTP ${outcome?.status}`);
}
if (outcome?.kind === 'transport') {
throw new CommandExecutionError(`${label} request failed: ${outcome.detail}`);
}
if (outcome?.kind === 'json') {
throw new CommandExecutionError(`${label} returned invalid JSON: ${outcome.detail}`);
}
if (outcome?.kind !== 'response' || !Number.isInteger(outcome.status)) {
throw new CommandExecutionError(`${label} returned an unexpected response`);
}
if (outcome.status < 200 || outcome.status >= 300) {
throw new CommandExecutionError(`${label} returned HTTP ${outcome.status}`);
}
return outcome.body;
}
/**
* 注入浏览器 evaluate 的 JS 函数字符串。View on GitHub (pinned to 49907e53dc)
Solutions
- Log into web.okjike.com in the driven browser and retry
- Confirm JK_ACCESS_TOKEN exists in localStorage on web.okjike.com; re-login if missing
- If 401/403 persists with a token present, log out/in to obtain a fresh token
- Use a persistent browser profile so the session is retained across CLI runs
Example fix
// before: expired token await postJikeApi(page, '/1.0/comment', body, 'comment'); // AuthRequiredError // after: refresh session first await loginJike(page); // re-authenticates and stores fresh JK_ACCESS_TOKEN await postJikeApi(page, '/1.0/comment', body, 'comment');
Defensive patterns
Strategy: try-catch
Validate before calling
const token = localStorage.getItem('JK_ACCESS_TOKEN');
if (!token) throw new Error('JK_ACCESS_TOKEN missing — log into web.okjike.com first'); Type guard
function isAuthError(e) { return e && e.name === 'AuthRequiredError'; } Try / catch
try {
const body = await postJikeApi(page, '/1.0/comment', payload, 'comment');
} catch (e) {
if (isAuthError(e)) {
await loginJike(page); // refresh token
return postJikeApi(page, '/1.0/comment', payload, 'comment');
}
throw e;
} Prevention
- Keep the browser session logged in before making POST calls
- Persist a dedicated browser profile for the CLI
- Re-authenticate when 401/403 recurs with an existing token
- Avoid clearing site data between runs
When it happens
Trigger: Calling any Jike command that goes through postJikeApi while logged out (no JK_ACCESS_TOKEN in localStorage) or with an expired/revoked token rejected as 401/403 by api.ruguoapp.com.
Common situations: Token expired after session rotation; Jike invalidated the device/token server-side; localStorage cleared between runs; running the command from a browser context that never completed login.
Related errors
- bbs.hupu.com
- HTTP ${response.status} - make sure you are logged in to Ins
- ${probe.detail}
- LinkedIn connections API authentication failed:
- ${label} authentication failed (HTTP ${result.status || 'aut
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1903516e31f88a73.
Report an issue: GitHub.