{"record":{"id":"15f95cc9e69ad19a","repo":"jackwener/OpenCLI","slug":"waiting-for-xiaohongshu-session-cookies","errorCode":null,"errorMessage":"Waiting for Xiaohongshu session cookies","messagePattern":"Waiting for Xiaohongshu session cookies","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"warning","filePath":"clis/xiaohongshu/auth.js","lineNumber":49,"sourceCode":"  if (!data) {\n    throw new CommandExecutionError('Xiaohongshu creator profile returned malformed personal_info payload');\n  }\n  return {\n    username: data.name ?? '',\n    followers: data.fans_count ?? 0,\n  };\n}\n\nregisterSiteAuthCommands({\n  site: 'xiaohongshu',\n  domain: 'creator.xiaohongshu.com',\n  loginUrl: 'https://creator.xiaohongshu.com/',\n  columns: ['username', 'followers'],\n  quickCheck: hasXhsSessionCookies,\n  verify: verifyXhsIdentity,\n  poll: async (page) => {\n    if (!await hasXhsSessionCookies(page)) {\n      throw new AuthRequiredError('creator.xiaohongshu.com', 'Waiting for Xiaohongshu session cookies');\n    }\n    return verifyXhsIdentity(page);\n  },\n});\n","sourceCodeStart":31,"sourceCodeEnd":54,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/auth.js#L31-L54","documentation":"The auth poll for creator.xiaohongshu.com throws this AuthRequiredError while waiting for the user to complete login: hasXhsSessionCookies(page) is still false, so the session isn't established yet. It is the library's way of saying 'keep waiting — the login flow isn't finished'.","triggerScenarios":"During the interactive login flow, the poll callback runs and the page still lacks the XHS session cookies (user hasn't finished QR-code/password login or cookies were blocked).","commonSituations":"User hasn't scanned the QR code yet; login page is stuck on CAPTCHA/verification; browser profile blocks or drops cookies (privacy settings, incognito); wrong login URL opened.","solutions":["Complete the login in the opened browser window (scan QR / enter credentials).","Wait and let the poll retry — the error clears once cookies appear.","Enable cookies for xiaohongshu.com in the browser profile.","Reload the login page if it is stuck on verification.","Verify the login URL is https://creator.xiaohongshu.com/ and reachable."],"exampleFix":"// before\nawait loginFlow.start(); // polls; throws 'Waiting for Xiaohongshu session cookies'\n// after\nawait loginFlow.start();\n// keep polling / prompt user until quickCheck passes:\nwhile (!await hasXhsSessionCookies(page)) {\n  promptUser('Finish login in the browser window...');\n  await sleep(2000);\n}","handlingStrategy":"retry","validationCode":"// check cookies yourself before/while waiting\nconst ready = await hasXhsSessionCookies(page);\nif (!ready) console.log('Waiting for user to finish login...');","typeGuard":null,"tryCatchPattern":"try {\n  const identity = await authPoll(page);\n} catch (e) {\n  if (/Waiting for Xiaohongshu session cookies/.test(e.message)) {\n    await sleep(3000);            // poll is still waiting — keep going\n    return authPoll(page);\n  }\n  throw e;\n}","preventionTips":["Prompt users clearly to complete QR/credential login in the opened window.","Enable cookies for xiaohongshu.com in the browser profile (avoid cookie-blocking modes).","Poll with a bounded retry loop instead of failing on the first 'waiting' error.","Verify the login URL (creator.xiaohongshu.com) is correct and reachable."],"tags":["auth","xiaohongshu","login-pending","cookies"],"backgroundTag":"auth-required-login-expired","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}