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

  1. Re-run `tiktok auth login` to obtain fresh session cookies — stale/revoked sessions are the top cause.
  2. Open tiktok.com in the profile manually and confirm you appear logged in (and solve any captcha), then retry verify.
  3. Increase the settle/wait before extraction if on a slow connection, or retry — the page may not have rehydrated in time.
  4. 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

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/e972320678fc02f0. Report an issue: GitHub.