jackwener/OpenCLI · error · AuthRequiredError
${result.detail}
Error message
${result.detail} What it means
The in-page whoami probe against /voyager/api/me returned kind:'auth', meaning the browser page itself detected an authentication problem (redirect to login / unauthenticated payload). The library surfaces the page-reported detail via AuthRequiredError so the user can re-authenticate.
Source
Thrown at clis/linkedin/auth.js:42
if (!res.ok) return { kind: 'http', httpStatus: res.status };
const d = await res.json();
const mini = d && d.miniProfile;
if (!mini || !mini.publicIdentifier) {
return { kind: 'auth', detail: 'LinkedIn /voyager/api/me 200 but miniProfile missing' };
}
const firstName = (mini.firstName && (mini.firstName.text || mini.firstName)) || '';
const lastName = (mini.lastName && (mini.lastName.text || mini.lastName)) || '';
return {
ok: true,
public_id: String(mini.publicIdentifier),
plain_id: String(d.plainId || ''),
name: String((firstName + ' ' + lastName).trim()),
};
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`);
if (result?.kind === 'auth') throw new AuthRequiredError('linkedin.com', result.detail);
if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /voyager/api/me`);
if (result?.kind === 'exception') throw new CommandExecutionError(`LinkedIn whoami failed: ${result.detail}`);
if (!result?.ok) throw new CommandExecutionError(`Unexpected LinkedIn probe: ${JSON.stringify(result)}`);
return { public_id: result.public_id, plain_id: result.plain_id, name: result.name };
}
registerSiteAuthCommands({
site: 'linkedin',
domain: 'www.linkedin.com',
loginUrl: 'https://www.linkedin.com/login',
columns: ['public_id', 'plain_id', 'name'],
quickCheck: hasLinkedinSessionCookie,
verify: verifyLinkedinIdentity,
poll: async (page) => {
if (!await hasLinkedinSessionCookie(page)) {
throw new AuthRequiredError('linkedin.com', 'Waiting for LinkedIn li_at cookie');
}
return verifyLinkedinIdentity(page);View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the interactive login flow to obtain a fresh session.
- Open linkedin.com in the automated browser and clear any checkpoint/2FA challenge, then retry.
- Avoid sharing one account across many IPs/automation agents; warm up the session.
- Check result.detail in the error message — it names the specific auth block LinkedIn returned.
Example fix
// before
await run('linkedin whoami'); // AuthRequiredError: <challenge detail>
// after
await run('auth linkedin'); // resolve checkpoint / fresh login
await run('linkedin whoami'); Defensive patterns
Strategy: try-catch
Validate before calling
// ensure the automated browser can load linkedin.com without redirects first
const res = await page.goto('https://www.linkedin.com/feed/');
if (!res || res.status() !== 200) await run('auth linkedin'); Type guard
null
Try / catch
try {
await run('linkedin whoami');
} catch (e) {
if (e instanceof AuthRequiredError) {
await run('auth linkedin'); // resolve checkpoint, fresh login
return run('linkedin whoami');
}
throw e;
} Prevention
- Resolve 2FA/checkpoint prompts promptly in the automated browser.
- Avoid sharing one LinkedIn account across many IPs or bots.
- Refresh the session periodically before it expires.
When it happens
Trigger: verifyLinkedinIdentity runs the page.evaluate whoami probe; the probe's response handling classifies the result as 'auth' (e.g. fetch redirected to login or returned an auth-challenge payload) even though li_at existed.
Common situations: li_at cookie present but expired/invalid server-side; LinkedIn challenging the session (2FA, checkpoint, suspicious-activity wall); cookie stolen/rotated by another login elsewhere.
Related errors
- 请先在共享 Chrome 完成 1688 登录/验证,再重试(${action})
- Bilibili ${label} API requires login or permission: ${messag
- bilibili.com
- ${probe.detail}
- result.detail (auth required from Claude probe)
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/96f42e052c2fd35a.
Report an issue: GitHub.