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

Auth with both GOOGLE and GEMINI keys set fails with unclear error message

Open fhinkel opened this issue 1 year ago • 4 comments

What happened?

When selecting "Gemini API Key" as auth method, I'm getting API Error: API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal. See https://cloud.google.com/docs/authentication (Status: UNAUTHENTICATED)

No other error indication. Only when using debug mode, I see what the issue is: ⚠ Both GOOGLE_API_KEY and GEMINI_API_KEY are set. Using GOOGLE_API_KEY. │ │ ℹ Authenticated via "gemini-api-key".

Please make sure that is surfaced in the error message as most people don't know about debug mode. Thanks!

Image

What did you expect to happen?

.

Client information

0.1.4 release

Login information

No response

Anything else we need to know?

No response

fhinkel avatar Jun 26 '25 17:06 fhinkel

Interestingly, this error is not coming from our code. It's coming from the GenAI library. I believe this might be due to recent changes we made to how keys are passed. Should be a simple fix.

scidomino avatar Jun 26 '25 17:06 scidomino

Interestingly, this error is not coming from our code. It's coming from the GenAI library. I believe this might be due to recent changes we made to how keys are passed. Should be a simple fix.

https://github.com/google-gemini/gemini-cli/pull/1381 has a fix.

mboshernitsan avatar Jun 26 '25 18:06 mboshernitsan

Same here. It´s a total mess.

sircode avatar Jun 26 '25 21:06 sircode

Assigning this to mboshernitsan since he has the PR to address it.

scidomino avatar Jun 27 '25 17:06 scidomino