Skip to content

authStatePath (WIGOLO_AUTH_STATE_PATH) is declared but never applied to the browser context #526

Description

@MeRezaRezaei

Summary

The useAuth / WIGOLO_AUTH_STATE_PATH feature plumbs an auth storageState path all the way from config → getAuthOptions() → the fetch router, but MultiBrowserPool.fetchWithBrowser never actually loads that storage state onto the Playwright context. As a result, an authenticated useAuth fetch runs as a logged-out visitor even though a valid storage-state file is configured.

Where the plumbing stops

  • src/fetch/auth.ts getAuthOptions() returns { storageStatePath } when WIGOLO_AUTH_STATE_PATH is set.
  • src/fetch/router.ts spreads it into fetchWithBrowser options (e.g. around lines 1084-1110).
  • src/fetch/browser-pool.ts declares storageStatePath in BrowserFetchOptions (line ~147) and only uses it as a gate to skip the cdp-direct escalation rung (line ~623). It is never passed to newContext({ storageState }), context.addCookies, or context.addInitScript.

The three newContext(...) call sites (pooled, CDP, stealth) all create the context without any storage-state restore. The sibling userDataDir (WIGOLO_CHROME_PROFILE_PATH) is likewise never consumed, but this issue focuses on the storageState half of useAuth.

Expected behavior

When storageStatePath is configured and the file exists, the context for that fetch should be seeded with the stored cookies (and origin localStorage), so useAuth fetches run as the authenticated account.

Environment

  • wigolo 0.2.1

Happy to open a PR implementing this if the approach is agreed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions