Skip to content

[BUG] Cookie authentication fails with "cookie may be expired or invalid" on WindowsΒ #26

@arturochian

Description

@arturochian

Environment Details

  • **Operating System:**Windows 10 Home 22H2
  • Node.js Version: v22.17.0
  • Python Version: 3.13.51420396 2025-07-09)
  • UV Version: 0.7.20 (251420396 2025-07-09)
  • Chrome for Testing Version: 138.0.7204.94 (Build oficial) (64 bits)

Bug Description

The MCP server fails to authenticate with LinkedIn using the cookie method. Despite a correct setup, the process consistently fails at the final authentication step, returning the error Login failed: Cookie authentication failed - cookie may be expired or invalid, even when using a freshly generated li_at cookie from a clean session.

Steps to Reproduce

  1. Cloned the repository on Windows.
  2. Installed uv using the recommended PowerShell script (irm https://astral.sh/uv/install.ps1 | iex).
  3. In the project directory, created and activated a virtual environment: uv venv and .\.venv\Scripts\Activate.ps1.
  4. Installed all dependencies successfully: uv sync and uv sync --group dev.
  5. Downloaded the matching "Chrome for Testing" browser and chromedriver.exe.
  6. Placed both chrome.exe and chromedriver.exe in the same directory (D:\ABCN\chrome-win64) and added this directory to the system's Path.
  7. Set the LINKEDIN_COOKIE environment variable with a fresh li_at cookie obtained after logging out of all other sessions.
  8. Ran the server manually with debug logging: uv run main.py --no-headless --no-lazy-init --log-level DEBUG.

Expected Behavior

The server should use the provided cookie, successfully authenticate the session in the automated "Chrome for Testing" browser, and become ready to accept commands.

Actual Behavior / Logs

The server starts, correctly reads the environment variables, finds the chromedriver, and launches the "Chrome for Testing" browser successfully. The WebDriver initializes correctly. However, the final authentication step fails.

The log shows the following critical error:

drivers.chrome - WARNING - Cookie authentication failed: Cookie login failed - cookie may be expired or invalid
main - ERROR - Failed to initialize driver: Login failed: Cookie authentication failed - cookie may be expired or invalid

Additional Context & Troubleshooting

  • The issue is not a port conflict (EADDRINUSE was resolved).
  • The issue is not the Path. We confirmed the script finds and uses the correct chromedriver.exe.
  • We also tried explicitly setting the CHROMEDRIVER_PATH environment variable, with the same result.
  • The failure seems to indicate that LinkedIn's current security measures may be detecting and invalidating the session when initiated by an automated browser, even if the cookie itself is valid.

Thank you for looking into this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions