{"record":{"id":"fa1c43c03c033768","repo":"jackwener/OpenCLI","slug":"waiting-for-douban-dbcl2-ck-cookies","errorCode":null,"errorMessage":"Waiting for Douban dbcl2 / ck cookies","messagePattern":"Waiting for Douban dbcl2 / ck cookies","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"info","filePath":"clis/douban/auth.js","lineNumber":59,"sourceCode":"  `);\n  if (probe?.kind === 'unknown' && cookieUid) {\n    return { user_id: cookieUid, name: '' };\n  }\n  if (probe?.kind === 'auth') throw new AuthRequiredError('douban.com', probe.detail);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Douban probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, name: probe.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'douban',\n  domain: 'douban.com',\n  loginUrl: 'https://accounts.douban.com/passport/login',\n  columns: ['user_id', 'name'],\n  quickCheck: hasDoubanSessionCookie,\n  verify: verifyDoubanIdentity,\n  poll: async (page) => {\n    if (!await hasDoubanSessionCookie(page)) {\n      throw new AuthRequiredError('douban.com', 'Waiting for Douban dbcl2 / ck cookies');\n    }\n    return verifyDoubanIdentity(page);\n  },\n});\n","sourceCodeStart":41,"sourceCodeEnd":64,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/douban/auth.js#L41-L64","documentation":"The douban poll hook runs while waiting for the user to finish logging in. Until hasDoubanSessionCookie sees dbcl2 or ck, it throws AuthRequiredError with 'Waiting for Douban dbcl2 / ck cookies' — this is the expected 'still waiting' signal, not a fatal failure.","triggerScenarios":"Polling starts before the user completes login at accounts.douban.com/passport/login; cookies not yet set in the profile being watched; login done in a different browser/profile than the one polled.","commonSituations":"User delays or abandons the interactive login; login completed in an incognito window instead of the managed profile; slow redirect delaying cookie set.","solutions":["Complete the login in the browser window that opencli opened (accounts.douban.com/passport/login)","If already logged in elsewhere, redo it in the managed profile so cookies land where the poller looks","Keep polling — the error clears automatically once dbcl2/ck appear"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const cookies = await page.getCookies({ url: 'https://www.douban.com' });\nif (!cookies.some(c => c.name === 'dbcl2' || c.name === 'ck')) {\n  console.log('Waiting for you to log in at accounts.douban.com/passport/login ...');\n}","typeGuard":"function hasDoubanSessionCookie(cookies) { return cookies.some(c => c.name === 'dbcl2' || c.name === 'ck'); }","tryCatchPattern":"try { await pollForAuth(); } catch (e) { if (e instanceof AuthRequiredError && /Waiting for/.test(e.message)) { /* keep polling */ } else throw e; }","preventionTips":["Complete the login inside the managed browser window, not incognito","Treat this message as transient and keep polling until timeout","Set a sane poll timeout and instruct users where to log in"],"tags":["auth","polling","cookies","douban","waiting-for-login"],"backgroundTag":"auth-cookies-missing","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}