jackwener/OpenCLI · error · AuthRequiredError
TikTok universal data has no owner user — identity not rehyd
Error message
TikTok universal data has no owner user — identity not rehydrated
What it means
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.
Source
Thrown at clis/tiktok/auth.js:47
if (Array.isArray(node)) { stack.push(...node); continue; }
const u = node.user;
if (u && typeof u === 'object') {
const isMe = Boolean(u.isOwner || u.is_owner || u.isCurrentUser);
if (isMe && (u.secUid || u.sec_uid)) {
return {
sec_uid: String(u.secUid || u.sec_uid),
username: String(u.uniqueId || u.unique_id || u.username || ''),
nickname: String(u.nickname || u.nickName || ''),
};
}
}
for (const v of Object.values(node)) if (v && typeof v === 'object') stack.push(v);
}
return null;
})()
`);
if (!info?.sec_uid) {
throw new AuthRequiredError('www.tiktok.com', 'TikTok universal data has no owner user — identity not rehydrated');
}
return { sec_uid: info.sec_uid, username: info.username, nickname: info.nickname };
}
registerSiteAuthCommands({
site: 'tiktok',
domain: 'tiktok.com',
loginUrl: 'https://www.tiktok.com/login',
columns: ['sec_uid', 'username', 'nickname'],
quickCheck: hasTiktokSessionCookie,
verify: verifyTiktokIdentity,
poll: async (page) => {
if (!await hasTiktokSessionCookie(page)) {
throw new AuthRequiredError('www.tiktok.com', 'Waiting for TikTok session cookies');
}
return verifyTiktokIdentity(page);
},
});View on GitHub (pinned to 49907e53dc)
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.
Defensive patterns
Strategy: retry
Validate before calling
// verify cookies are still accepted by hitting an authed endpoint first
const res = await fetch('https://www.tiktok.com/api/user/info/self', { headers: { cookie: cookieHeader } });
if (res.status !== 200) console.warn('TikTok session likely stale — re-login recommended'); Try / catch
try {
return await tiktokAuth.verify(page);
} catch (e) {
if (e instanceof AuthRequiredError && /no owner user/.test(e.message)) {
await tiktokAuth.login(); // stale cookies: full re-login
return tiktokAuth.verify(page);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- TikTok session cookies (sessionid/sid_tt/uid_tt) missing
- AUTH_REQUIRED
- 未获取到课程列表
- Chaoxing session cookies missing
- ChatGPT project requires a logged-in ChatGPT session.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e972320678fc02f0.
Report an issue: GitHub.