{"record":{"id":"96f42e052c2fd35a","repo":"jackwener/OpenCLI","slug":"result-detail-96f42e","errorCode":null,"errorMessage":"${result.detail}","messagePattern":"\\$\\{result\\.detail\\}","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/auth.js","lineNumber":42,"sourceCode":"      if (!res.ok) return { kind: 'http', httpStatus: res.status };\n      const d = await res.json();\n      const mini = d && d.miniProfile;\n      if (!mini || !mini.publicIdentifier) {\n        return { kind: 'auth', detail: 'LinkedIn /voyager/api/me 200 but miniProfile missing' };\n      }\n      const firstName = (mini.firstName && (mini.firstName.text || mini.firstName)) || '';\n      const lastName = (mini.lastName && (mini.lastName.text || mini.lastName)) || '';\n      return {\n        ok: true,\n        public_id: String(mini.publicIdentifier),\n        plain_id: String(d.plainId || ''),\n        name: String((firstName + ' ' + lastName).trim()),\n      };\n    } catch (e) {\n      return { kind: 'exception', detail: String(e && e.message || e) };\n    }\n  })()`);\n  if (result?.kind === 'auth') throw new AuthRequiredError('linkedin.com', result.detail);\n  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /voyager/api/me`);\n  if (result?.kind === 'exception') throw new CommandExecutionError(`LinkedIn whoami failed: ${result.detail}`);\n  if (!result?.ok) throw new CommandExecutionError(`Unexpected LinkedIn probe: ${JSON.stringify(result)}`);\n  return { public_id: result.public_id, plain_id: result.plain_id, name: result.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'linkedin',\n  domain: 'www.linkedin.com',\n  loginUrl: 'https://www.linkedin.com/login',\n  columns: ['public_id', 'plain_id', 'name'],\n  quickCheck: hasLinkedinSessionCookie,\n  verify: verifyLinkedinIdentity,\n  poll: async (page) => {\n    if (!await hasLinkedinSessionCookie(page)) {\n      throw new AuthRequiredError('linkedin.com', 'Waiting for LinkedIn li_at cookie');\n    }\n    return verifyLinkedinIdentity(page);","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/auth.js#L24-L60","documentation":"The in-page whoami probe against /voyager/api/me returned kind:'auth', meaning the browser page itself detected an authentication problem (redirect to login / unauthenticated payload). The library surfaces the page-reported detail via AuthRequiredError so the user can re-authenticate.","triggerScenarios":"verifyLinkedinIdentity runs the page.evaluate whoami probe; the probe's response handling classifies the result as 'auth' (e.g. fetch redirected to login or returned an auth-challenge payload) even though li_at existed.","commonSituations":"li_at cookie present but expired/invalid server-side; LinkedIn challenging the session (2FA, checkpoint, suspicious-activity wall); cookie stolen/rotated by another login elsewhere.","solutions":["Re-run the interactive login flow to obtain a fresh session.","Open linkedin.com in the automated browser and clear any checkpoint/2FA challenge, then retry.","Avoid sharing one account across many IPs/automation agents; warm up the session.","Check result.detail in the error message — it names the specific auth block LinkedIn returned."],"exampleFix":"// before\nawait run('linkedin whoami'); // AuthRequiredError: <challenge detail>\n// after\nawait run('auth linkedin');   // resolve checkpoint / fresh login\nawait run('linkedin whoami');","handlingStrategy":"try-catch","validationCode":"// ensure the automated browser can load linkedin.com without redirects first\nconst res = await page.goto('https://www.linkedin.com/feed/');\nif (!res || res.status() !== 200) await run('auth linkedin');","typeGuard":"null","tryCatchPattern":"try {\n  await run('linkedin whoami');\n} catch (e) {\n  if (e instanceof AuthRequiredError) {\n    await run('auth linkedin'); // resolve checkpoint, fresh login\n    return run('linkedin whoami');\n  }\n  throw e;\n}","preventionTips":["Resolve 2FA/checkpoint prompts promptly in the automated browser.","Avoid sharing one LinkedIn account across many IPs or bots.","Refresh the session periodically before it expires."],"tags":["auth","session-expired","voyager-api"],"backgroundTag":"auth-challenge-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}