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

Failed to login on company proxy/vpn. reason: self-signed certificate in certificate chain

Open hairinwind opened this issue 1 year ago • 3 comments

What happened?

Here is the error when I was on company proxy/vpn. Failed to login. Message: request to https://oauth2.googleapis.com/token failed, reason: self-signed │ │ certificate in certificate chain

I saw this https://discuss.ai.google.dev/t/gemini-api-connection-ssl-error/335/9

How to set transport=‘rest’ in gemini CLI?

What did you expect to happen?

expect to be able to login

Client information

$ gemini /about
# paste output here

Login information

No response

Anything else we need to know?

No response

hairinwind avatar Jun 27 '25 22:06 hairinwind

gemini-cli cannot use gemini-2.5-pro, and automatically switches to gemini-2.5-flash after startup. It cannot be used at all

zhengguangli avatar Jun 28 '25 03:06 zhengguangli

This issue is caused by the corporate VPN inserting a self-signed certificate that Node.js does not trust by default, and is not an issue with Gemini CLI. Here's how to fix it:

1. Register your company’s certificate with Node.js (Recommended) Set the following environment variable in PowerShell (adjust the path to your certificate):

$env:NODE_EXTRA_CA_CERTS="C:\path\to\corp-cert.crt"

or,

2. Disable SSL certificate verification in Node.js (Not recommended) This bypasses certificate validation entirely, which can expose you to security risks:

npm config set strict-ssl false -g

Hope this helps!

hojunkim13 avatar Jul 10 '25 04:07 hojunkim13

Found possible duplicate issues:

  • #4581: (0.9048164543618901)
  • #2350: (0.904660701751709)

gsquared94 avatar Jul 30 '25 20:07 gsquared94