gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Cannot login using Google Account on terminal only environment

Open Erland366 opened this issue 1 year ago • 7 comments

Describe the bug I assume what should happened when we select login with google account is that it should open a web browser and we login in through there.

But I am SSH-ing to terminal only environment, and after selecting that, it immediately throws an error of this which I assume is because it cannot open the web browser :

Error: spawn xdg-open ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [
    'https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A33219%2Foauth2callback&access_type=offline&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&state=74a2874c4ccad6d4515afef33177b08e2b799163f2634510a8d0d2146c551589&response_type=code&client_id=681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com'
  ]
}

I cannot even change the login method to using API key since even launching the app immediately throws the error.

Erland366 avatar Jun 25 '25 14:06 Erland366

Same issue, even if you uninstall the npm package and reinstall it still uses the login mode by default, maybe need to delete the global node_modules reset

AtomRun avatar Jun 25 '25 14:06 AtomRun

yup - same running in a devcontainer

jmls avatar Jun 25 '25 14:06 jmls

mee too

myysophia avatar Jun 25 '25 14:06 myysophia

same issue just now

Idadelveloper avatar Jun 25 '25 14:06 Idadelveloper

This is a known limitation documented in authentication.md:

Note that the web login must be done in a browser that can communicate with the machine Gemini CLI is being run from. (Specifically, the browser will be redirected to a localhost url that Gemini CLI will be listening on).

We do plan on allowing this soon, however.

scidomino avatar Jun 25 '25 14:06 scidomino

Closing this as a duplicate of https://github.com/google-gemini/gemini-cli/issues/1439

scidomino avatar Jun 25 '25 14:06 scidomino

Found possible duplicate issues:\n\n- #1521: (0.918615877628333)\n\n

gsquared94 avatar Jul 30 '25 22:07 gsquared94