gemini-cli - 💡(How to fix) Fix OAuth flow fails in SSH/Headless sessions - Browser cannot be opened

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

refresh failed: error getting token source: You are not logged into Antigravity. refresh failed: error getting token source: You are not logged into Antigravity. refresh failed: error getting token source: You are not logged into Antigravity. refresh failed: error getting token source: You are not logged into Antigravity. refresh failed: error getting token source: You are not logged into Antigravity.

Root Cause

1 ### Environment 2 - CLI Version: 0.42.0 (Antigravity/Gemini CLI) 3 - OS: Linux (VM) 4 - Access Method: SSH 5 6 ### Problem Statement 7 When running the CLI over an SSH session, the tool correctly detects the SSH environment: 8 I0520 02:38:46.171139 504064 token_storage.go:50] Using file-based token storage because SSH session detected 9 10 However, it still attempts to initiate a standard browser-based OAuth flow: 11 I0520 02:38:47.953528 504064 auth_manager.go:93] Starting OAuth authentication flow 12 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow 13 14 In a headless or remote SSH environment, no browser is available. The CLI hangs or fails because it cannot complete the authentication process. 15 16 ### Expected Behavior 17 The CLI should provide a Device Code Flow (copy-paste URL and code) or a manual token input mechanism when an SSH session is detected, instead of attempting to open a local browser. 18 19 ### Logs 20 (Excerpts from ~/.gemini/antigravity-cli/log/cli-*.log) 21 ... 22 W0520 02:38:46.170880 504064 log_context.go:117] Cache(loadCodeAssistResponse): Singleflight refresh failed: error getting token source: You are not logged into Antigravity. 23 ... 24 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow

RAW_BUFFERClick to expand / collapse

What happened?

1 ### Environment
2 - **CLI Version:** 0.42.0 (Antigravity/Gemini CLI)
3 - **OS:** Linux (VM)
4 - **Access Method:** SSH
5
6 ### Problem Statement
7 When running the CLI over an SSH session, the tool correctly detects the SSH environment:
8 `I0520 02:38:46.171139 504064 token_storage.go:50] Using file-based token storage because SSH
  session detected`
9

10 However, it still attempts to initiate a standard browser-based OAuth flow: 11 I0520 02:38:47.953528 504064 auth_manager.go:93] Starting OAuth authentication flow 12 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow 13 14 In a headless or remote SSH environment, no browser is available. The CLI hangs or fails because it cannot complete the authentication process. 15 16 ### Expected Behavior 17 The CLI should provide a Device Code Flow (copy-paste URL and code) or a manual token input mechanism when an SSH session is detected, instead of attempting to open a local browser. 18 19 ### Logs 20 (Excerpts from ~/.gemini/antigravity-cli/log/cli-*.log) 21 ... 22 W0520 02:38:46.170880 504064 log_context.go:117] Cache(loadCodeAssistResponse): Singleflight refresh failed: error getting token source: You are not logged into Antigravity. 23 ... 24 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow

What did you expect to happen?

1 ### Environment
2 - **CLI Version:** 0.42.0 (Antigravity/Gemini CLI)
3 - **OS:** Linux (VM)
4 - **Access Method:** SSH
5
6 ### Problem Statement
7 When running the CLI over an SSH session, the tool correctly detects the SSH environment:
8 `I0520 02:38:46.171139 504064 token_storage.go:50] Using file-based token storage because SSH
  session detected`
9

10 However, it still attempts to initiate a standard browser-based OAuth flow: 11 I0520 02:38:47.953528 504064 auth_manager.go:93] Starting OAuth authentication flow 12 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow 13 14 In a headless or remote SSH environment, no browser is available. The CLI hangs or fails because it cannot complete the authentication process. 15 16 ### Expected Behavior 17 The CLI should provide a Device Code Flow (copy-paste URL and code) or a manual token input mechanism when an SSH session is detected, instead of attempting to open a local browser. 18 19 ### Logs 20 (Excerpts from ~/.gemini/antigravity-cli/log/cli-*.log) 21 ... 22 W0520 02:38:46.170880 504064 log_context.go:117] Cache(loadCodeAssistResponse): Singleflight refresh failed: error getting token source: You are not logged into Antigravity. 23 ... 24 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow

Client information

1 ### Environment
2 - **CLI Version:** 0.42.0 (Antigravity/Gemini CLI)
3 - **OS:** Linux (VM)
4 - **Access Method:** SSH
5
6 ### Problem Statement
7 When running the CLI over an SSH session, the tool correctly detects the SSH environment:
8 `I0520 02:38:46.171139 504064 token_storage.go:50] Using file-based token storage because SSH
  session detected`
9

10 However, it still attempts to initiate a standard browser-based OAuth flow: 11 I0520 02:38:47.953528 504064 auth_manager.go:93] Starting OAuth authentication flow 12 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow 13 14 In a headless or remote SSH environment, no browser is available. The CLI hangs or fails because it cannot complete the authentication process. 15 16 ### Expected Behavior 17 The CLI should provide a Device Code Flow (copy-paste URL and code) or a manual token input mechanism when an SSH session is detected, instead of attempting to open a local browser. 18 19 ### Logs 20 (Excerpts from ~/.gemini/antigravity-cli/log/cli-*.log) 21 ... 22 W0520 02:38:46.170880 504064 log_context.go:117] Cache(loadCodeAssistResponse): Singleflight refresh failed: error getting token source: You are not logged into Antigravity. 23 ... 24 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow

Login information

1 ### Environment
2 - **CLI Version:** 0.42.0 (Antigravity/Gemini CLI)
3 - **OS:** Linux (VM)
4 - **Access Method:** SSH
5
6 ### Problem Statement
7 When running the CLI over an SSH session, the tool correctly detects the SSH environment:
8 `I0520 02:38:46.171139 504064 token_storage.go:50] Using file-based token storage because SSH
  session detected`
9

10 However, it still attempts to initiate a standard browser-based OAuth flow: 11 I0520 02:38:47.953528 504064 auth_manager.go:93] Starting OAuth authentication flow 12 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow 13 14 In a headless or remote SSH environment, no browser is available. The CLI hangs or fails because it cannot complete the authentication process. 15 16 ### Expected Behavior 17 The CLI should provide a Device Code Flow (copy-paste URL and code) or a manual token input mechanism when an SSH session is detected, instead of attempting to open a local browser. 18 19 ### Logs 20 (Excerpts from ~/.gemini/antigravity-cli/log/cli-*.log) 21 ... 22 W0520 02:38:46.170880 504064 log_context.go:117] Cache(loadCodeAssistResponse): Singleflight refresh failed: error getting token source: You are not logged into Antigravity. 23 ... 24 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow

Anything else we need to know?

1 ### Environment
2 - **CLI Version:** 0.42.0 (Antigravity/Gemini CLI)
3 - **OS:** Linux (VM)
4 - **Access Method:** SSH
5
6 ### Problem Statement
7 When running the CLI over an SSH session, the tool correctly detects the SSH environment:
8 `I0520 02:38:46.171139 504064 token_storage.go:50] Using file-based token storage because SSH
  session detected`
9

10 However, it still attempts to initiate a standard browser-based OAuth flow: 11 I0520 02:38:47.953528 504064 auth_manager.go:93] Starting OAuth authentication flow 12 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow 13 14 In a headless or remote SSH environment, no browser is available. The CLI hangs or fails because it cannot complete the authentication process. 15 16 ### Expected Behavior 17 The CLI should provide a Device Code Flow (copy-paste URL and code) or a manual token input mechanism when an SSH session is detected, instead of attempting to open a local browser. 18 19 ### Logs 20 (Excerpts from ~/.gemini/antigravity-cli/log/cli-*.log) 21 ... 22 W0520 02:38:46.170880 504064 log_context.go:117] Cache(loadCodeAssistResponse): Singleflight refresh failed: error getting token source: You are not logged into Antigravity. 23 ... 24 I0520 02:38:47.953623 504064 browser.go:55] consumerOAuth: starting OAuth flow

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING