Skip to content

fix(auth): platform-aware default Chrome profile path#1

Open
doziedotdev wants to merge 1 commit into
yudduy:mainfrom
doziedotdev:fix/linux-chrome-profile-path
Open

fix(auth): platform-aware default Chrome profile path#1
doziedotdev wants to merge 1 commit into
yudduy:mainfrom
doziedotdev:fix/linux-chrome-profile-path

Conversation

@doziedotdev
Copy link
Copy Markdown

Summary

The default Chrome profile path in src/auth-interactive.mjs is hardcoded to the macOS location:

resolve(process.env.HOME, 'Library/Application Support/Google/Chrome')

On Linux and Windows this directory doesn't exist, so node src/auth-interactive.mjs fails immediately with Chrome profile not found at /home/<user>/Library/Application Support/Google/Chrome unless the user already knows to set GEMINI_WEB_CHROME_USER_DATA.

This PR picks the default based on process.platform:

Platform Default path
darwin ~/Library/Application Support/Google/Chrome (unchanged)
linux ~/.config/google-chrome
win32 %LOCALAPPDATA%/Google/Chrome/User Data
other linux default (safe fallback)

The GEMINI_WEB_CHROME_USER_DATA env var still overrides everything, so existing setups are unaffected.

Test plan

  • Fedora 42, Chrome installed at ~/.config/google-chrome - auth flow completes, cookies saved to ~/.gemini-cli-web/auth.json.
  • node --check src/auth-interactive.mjs passes.
  • macOS - unchanged path, regression-free by inspection.
  • Windows - path construction verified by inspection; needs a Windows tester to confirm the actual directory layout.

Notes

No changes to the public CLI, env vars, or on-disk auth format. Purely a default-value improvement.

The hardcoded `~/Library/Application Support/Google/Chrome` default
assumed macOS and caused `node src/auth-interactive.mjs` to fail with
"Chrome profile not found" for every Linux and Windows user whose
`GEMINI_WEB_CHROME_USER_DATA` was not set.

Select the default based on `process.platform`:

- darwin  -> `~/Library/Application Support/Google/Chrome`
- linux   -> `~/.config/google-chrome`
- win32   -> `%LOCALAPPDATA%/Google/Chrome/User Data`
- other   -> linux default (safe fallback)

The `GEMINI_WEB_CHROME_USER_DATA` env var still overrides everything,
so existing setups are unaffected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant