Skip to content

Login fails for UK/regional users: cookies set on .google.co.uk instead of .google.com #146

@AndrewBeniston

Description

@AndrewBeniston

Bug

notebooklm login completes successfully but all subsequent commands fail with:

Error: Authentication expired or invalid. Redirected to: https://accounts.google.com/...
Run 'notebooklm login' to re-authenticate.

Root Cause

For users in the UK (and likely other regional Google domains), the login flow sets auth cookies (SID, HSID, SSID, APISID, SAPISID, etc.) on .google.co.uk instead of .google.com. The notebooklm.google.com API rejects these regional domain cookies.

Storage state after login shows:

.google.co.uk    SID, HSID, SSID, APISID, SAPISID, __Secure-1PSID, ...
.google.com      AEC, __Secure-BUCKET, __Secure-ENID, NID  (no SID!)

The library correctly extracts the SID from .google.co.uk (it's in GOOGLE_REGIONAL_CCTLDS), but when sent as a Cookie header to notebooklm.google.com, the server doesn't accept it — the token value itself is domain-specific.

Fix

Adding cross-domain navigation after the user presses Enter in the login flow forces Google to set .google.com cookies:

# In session.py login(), after input("[Press ENTER when logged in] "):

# Navigate to accounts.google.com to ensure .google.com cookies are set
# (fixes UK/regional users whose cookies land on .google.co.uk)
page.goto("https://accounts.google.com/", wait_until="networkidle")
page.goto("https://myaccount.google.com/", wait_until="networkidle")
# Return to NotebookLM to capture its specific cookies too
page.goto("https://notebooklm.google.com/", wait_until="networkidle")

This triggers Google's cross-domain cookie propagation, resulting in valid .google.com SID cookies in the storage state.

Affected Users

Anyone whose Google login flow routes through a regional domain (.google.co.uk, .google.co.jp, .google.de, etc.) — essentially the same regions listed in GOOGLE_REGIONAL_CCTLDS.

Environment

  • notebooklm-py 0.3.3
  • macOS, Python 3.12
  • UK-based Google account

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