docs/factory.md
Factory (displayed as "Droid") is web-based. We authenticate via cookies or WorkOS tokens and call Factory APIs.
Fetch attempts run in this exact order:
com.steipete.codexbar.cache, account cookie.factory).~/Library/Application Support/CodexBar/factory-session.json).If a step succeeds, we cache cookies/tokens back into the session store.
Manual option:
Cookie: header from app.factory.ai.factory.ai, app.factory.ai, auth.factory.ai.wos-session__Secure-next-auth.session-tokennext-auth.session-token__Secure-authjs.session-token__Host-authjs.csrf-tokenauthjs.session-tokensessionaccess-tokenaccess-token, __recent_auth.https://auth.factory.aihttps://api.factory.aihttps://app.factory.aibaseURL (default https://app.factory.ai)All requests set:
Accept: application/jsonContent-Type: application/jsonOrigin: https://app.factory.aiReferer: https://app.factory.ai/x-factory-client: web-appAuthorization: Bearer <token> when a bearer token is available.Cookie: <session cookies> when cookies are available.Endpoints:
GET <baseURL>/api/app/auth/me
POST <baseURL>/api/organization/subscription/usage
{ "useCache": true, "userId": "<id?>" }POST https://api.workos.com/user_management/authenticateclient_id: one of
client_01HXRMBQ9BJ3E7QSTQ9X2PHVB7client_01HNM792M5G5G1A2THWPXKFMXBgrant_type: refresh_tokenrefresh_token: from local storage or session storeorganization_iduseCookie: true + Cookie: <workos.com cookies>~/Library/Containers/com.apple.Safari/Data/Library/WebKit/WebsiteData/Defaultorigin files containing app.factory.ai or auth.factory.ai, then reads
LocalStorage/localstorage.sqlite3.~/Library/Application Support/<Browser>/User Data/<Profile>/Local Storage/leveldb.~/Library/Application Support/net.imput.helium/<Profile>/Local Storage/leveldb (no User Data).workos:refresh-token and workos:access-token.workos:refresh-token (required)workos:access-token (optional)~/Library/Application Support/CodexBar/factory-session.jsonSources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swiftSources/CodexBarCore/Providers/Factory/FactoryLocalStorageImporter.swift