jackwener/OpenCLI · error · AuthRequiredError
${probe.detail}
Error message
${probe.detail} What it means
verifyDoubanIdentity probes the /mine/ page in the browser to determine the logged-in user. When the probe returns kind 'auth' the page shows a login/blocked state, so the library raises AuthRequiredError with the probe's detail text describing what it observed (e.g. a login redirect).
Source
Thrown at clis/douban/auth.js:45
(() => {
const parseUid = (value) => String(value || '').match(/(?:^|\\/)people\\/(\\d+)\\/?/)?.[1] || '';
const currentUrl = new URL(window.location.href);
if (currentUrl.hostname === 'accounts.douban.com' || currentUrl.pathname.startsWith('/passport/')) {
return { kind: 'auth', detail: 'Douban /mine redirected to the login flow' };
}
const navUser = document.querySelector('.nav-user-account .bn-more, .top-nav-info a.bn-more');
const navHref = navUser?.getAttribute('href') || navUser?.href || '';
const user_id = parseUid(window.location.href) || parseUid(navHref);
const name = (navUser?.textContent || document.querySelector('.info h1, h1')?.textContent || '').trim();
return user_id
? { ok: true, user_id, name }
: { kind: 'unknown', detail: 'Douban user_id parse failed: href=' + navHref + ' location=' + window.location.href };
})()
`);
if (probe?.kind === 'unknown' && cookieUid) {
return { user_id: cookieUid, name: '' };
}
if (probe?.kind === 'auth') throw new AuthRequiredError('douban.com', probe.detail);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Douban probe: ${JSON.stringify(probe)}`);
return { user_id: probe.user_id, name: probe.name };
}
registerSiteAuthCommands({
site: 'douban',
domain: 'douban.com',
loginUrl: 'https://accounts.douban.com/passport/login',
columns: ['user_id', 'name'],
quickCheck: hasDoubanSessionCookie,
verify: verifyDoubanIdentity,
poll: async (page) => {
if (!await hasDoubanSessionCookie(page)) {
throw new AuthRequiredError('douban.com', 'Waiting for Douban dbcl2 / ck cookies');
}
return verifyDoubanIdentity(page);
},
});View on GitHub (pinned to 49907e53dc)
Solutions
- Re-authenticate: run the douban login flow and sign in again in the reused browser
- Open douban.com in that browser manually and complete any captcha/risk-control challenge, then retry
- Clear stale douban cookies and log in fresh
Defensive patterns
Strategy: try-catch
Validate before calling
await page.goto('https://www.douban.com/mine/');
const loggedIn = !page.url().includes('accounts.douban.com/passport/login');
if (!loggedIn) await runDoubanLogin(); Type guard
function probeLooksAuthBlocked(probe) { return probe && probe.kind === 'auth'; } Try / catch
try { const id = await verifyDoubanIdentity(page); } catch (e) { if (e instanceof AuthRequiredError) { console.error('Douban session invalid — re-login in the reused browser:', e.message); } else throw e; } Prevention
- Re-login when dbcl2/ck cookies are stale rather than reusing them
- Complete captcha/risk-control challenges manually before automation
- Keep the interactive login browser and automation profile identical
When it happens
Trigger: dbcl2/ck cookie exists but is expired or invalid, so /mine/ redirects to login; douban anti-bot challenge (sec.douban.com) intercepts the probe; the page's nav links contain no parsable user id and the probe classifies the state as an auth wall.
Common situations: Session cookie survives but the server-side session was revoked; risk-control blocking of automated access; logging out in the browser while cookies linger.
Related errors
- Douban dbcl2 / ck cookies missing
- AUTH_REQUIRED
- 获取抖音上传授权失败: ${message}
- weibo.com
- Please log in to the WeChat Official Account platform and re
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/7466ed219a1be520.
Report an issue: GitHub.