{"record":{"id":"cdb3407a2486e2ac","repo":"jackwener/OpenCLI","slug":"creator-douyin-com-cdb340","errorCode":null,"errorMessage":"creator.douyin.com","messagePattern":"creator\\.douyin\\.com","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"info","filePath":"clis/douyin/auth.js","lineNumber":35,"sourceCode":"    throw new CommandExecutionError('Douyin user info response is missing user_info');\n  }\n  return {\n    id: user.uid ?? '',\n    username: user.nickname ?? '',\n    followers: user.follower_count ?? 0,\n  };\n}\n\nregisterSiteAuthCommands({\n  site: 'douyin',\n  domain: 'creator.douyin.com',\n  loginUrl: 'https://creator.douyin.com/',\n  columns: ['id', 'username', 'followers'],\n  quickCheck: hasDouyinSessionCookies,\n  verify: verifyDouyinIdentity,\n  poll: async (page) => {\n    if (!await hasDouyinSessionCookies(page)) {\n      throw new AuthRequiredError('creator.douyin.com', 'Waiting for Douyin creator session cookies');\n    }\n    return verifyDouyinIdentity(page);\n  },\n});\n","sourceCodeStart":17,"sourceCodeEnd":40,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/douyin/auth.js#L17-L40","documentation":"An AuthRequiredError raised by the douyin auth poll handler when, while polling during interactive login, none of the expected session cookies (sessionid, uid_tt, passport_csrf_token) are present for creator.douyin.com. It signals the login flow that authentication is still pending. The library throws it so polling continues until the user finishes the QR login.","triggerScenarios":"Polling started before the user scanned the QR code or clicked confirm; user opened the login page but logged into a different Douyin property (no creator.douyin.com cookies); cookies blocked in the browser context; user cancelled login.","commonSituations":"Automated login timeouts when nobody completes the QR scan; headless browser contexts with cookies disabled; cookie policy changes (e.g. cookie name churn) making the check fail even after login.","solutions":["Complete the QR login in the opened browser window for creator.douyin.com","Verify the browser context allows cookies and is not isolating creator.douyin.com","Check actual cookie names after login and update hasDouyinSessionCookies if Douyin renamed them","Restart the auth flow with a longer timeout if polling expired"],"exampleFix":"// before: poll throws immediately before login completes\nconst res = await poll(page); // AuthRequiredError\n// after: wait for login, then poll\nawait page.waitForFunction(() => document.cookie.includes('sessionid='), { timeout: 120000 });\nconst res = await poll(page);","handlingStrategy":"retry","validationCode":"const cookies = await page.getCookies({ url: 'https://creator.douyin.com' });\nconst names = new Set(cookies.map(c => c.name));\nconst loggedIn = names.has('sessionid') || names.has('uid_tt') || names.has('passport_csrf_token');","typeGuard":"function hasSessionCookies(cookies) {\n  const names = new Set(cookies.map(c => c.name));\n  return names.has('sessionid') || names.has('uid_tt') || names.has('passport_csrf_token');\n}","tryCatchPattern":"try {\n  const identity = await poll(page);\n} catch (e) {\n  if (e instanceof AuthRequiredError || /creator\\.douyin\\.com/.test(e.message)) {\n    await waitForLogin(page, { timeout: 120000 }); // keep waiting for QR scan\n    return poll(page);\n  } throw e;\n}","preventionTips":["Ensure the browser context allows persistent cookies","Complete the QR login within the polling timeout window","Confirm you are logging into creator.douyin.com specifically, not other Douyin properties","Update cookie-name checks if Douyin renames session cookies"],"tags":["douyin","auth","cookies","login"],"backgroundTag":"auth-session-cookies-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}