{"record":{"id":"e972320678fc02f0","repo":"jackwener/OpenCLI","slug":"tiktok-universal-data-has-no-owner-user-identity","errorCode":null,"errorMessage":"TikTok universal data has no owner user — identity not rehydrated","messagePattern":"TikTok universal data has no owner user — identity not rehydrated","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/tiktok/auth.js","lineNumber":47,"sourceCode":"        if (Array.isArray(node)) { stack.push(...node); continue; }\n        const u = node.user;\n        if (u && typeof u === 'object') {\n          const isMe = Boolean(u.isOwner || u.is_owner || u.isCurrentUser);\n          if (isMe && (u.secUid || u.sec_uid)) {\n            return {\n              sec_uid: String(u.secUid || u.sec_uid),\n              username: String(u.uniqueId || u.unique_id || u.username || ''),\n              nickname: String(u.nickname || u.nickName || ''),\n            };\n          }\n        }\n        for (const v of Object.values(node)) if (v && typeof v === 'object') stack.push(v);\n      }\n      return null;\n    })()\n  `);\n  if (!info?.sec_uid) {\n    throw new AuthRequiredError('www.tiktok.com', 'TikTok universal data has no owner user — identity not rehydrated');\n  }\n  return { sec_uid: info.sec_uid, username: info.username, nickname: info.nickname };\n}\n\nregisterSiteAuthCommands({\n  site: 'tiktok',\n  domain: 'tiktok.com',\n  loginUrl: 'https://www.tiktok.com/login',\n  columns: ['sec_uid', 'username', 'nickname'],\n  quickCheck: hasTiktokSessionCookie,\n  verify: verifyTiktokIdentity,\n  poll: async (page) => {\n    if (!await hasTiktokSessionCookie(page)) {\n      throw new AuthRequiredError('www.tiktok.com', 'Waiting for TikTok session cookies');\n    }\n    return verifyTiktokIdentity(page);\n  },\n});","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/tiktok/auth.js#L29-L65","documentation":"After confirming session cookies exist, `verifyTiktokIdentity` navigates to tiktok.com/foryou, waits, and parses the `__UNIVERSAL_DATA_FOR_REHYDRATION__` script tag to find the owner user's `sec_uid`. If the parsed data has no owner (no `sec_uid`), it throws AuthRequiredError: the cookies exist but the page did not rehydrate a logged-in identity, so ownership cannot be proven.","triggerScenarios":"Calling `tiktok auth verify` when session cookies are stale/invalid (TikTok revoked them server-side), the /foryou page rendered a logged-out or captcha variant, the universal-data script tag is missing or its schema changed, or the page was captured before rehydration finished.","commonSituations":"TikTok invalidated sessions after a password change or security sweep; IP flagged so TikTok serves an anonymous page despite cookies; TikTok renamed/restructured the rehydration JSON; slow network causing premature evaluation (partially mitigated by the wait).","solutions":["Re-run `tiktok auth login` to obtain fresh session cookies — stale/revoked sessions are the top cause.","Open tiktok.com in the profile manually and confirm you appear logged in (and solve any captcha), then retry verify.","Increase the settle/wait before extraction if on a slow connection, or retry — the page may not have rehydrated in time.","If cookies are valid but the tag is consistently absent, TikTok changed its bootstrap markup — update the library."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify cookies are still accepted by hitting an authed endpoint first\nconst res = await fetch('https://www.tiktok.com/api/user/info/self', { headers: { cookie: cookieHeader } });\nif (res.status !== 200) console.warn('TikTok session likely stale — re-login recommended');","typeGuard":null,"tryCatchPattern":"try {\n  return await tiktokAuth.verify(page);\n} catch (e) {\n  if (e instanceof AuthRequiredError && /no owner user/.test(e.message)) {\n    await tiktokAuth.login(); // stale cookies: full re-login\n    return tiktokAuth.verify(page);\n  }\n  throw e;\n}","preventionTips":["Treat this as stale-session: re-login rather than retrying verification.","Schedule periodic re-login before sessions expire.","Verify on a clean residential IP; flagged IPs get logged-out pages despite valid cookies.","After TikTok front-end updates, confirm __UNIVERSAL_DATA_FOR_REHYDRATION__ still exists."],"tags":["tiktok","auth","session","rehydration"],"backgroundTag":"auth-identity-unverified","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}