google-gemini / google-gemini/gemini-cli

Gemini CLI v0.52.0 returns ACCESS_TOKEN_TYPE_UNSUPPORTED with valid GEMINI_API_KEY

Open
#28,538 0 comments 0 reactions 0 assignees View on GitHub
area/security kind/bug priority/p1 status/bot-triaged
Dominant language
TypeScript
Stars
107k
Forks
14.6k
Avg merge
2d 3h
Merged PRs (30d)
45

Description

### What happened?

Gemini CLI authenticates successfully using GEMINI_API_KEY.

The REST API works correctly.

Example:

curl https://generativelanguage.googleapis.com/v1beta/models

returns the model list successfully.

However every prompt in Gemini CLI fails with:

401 UNAUTHENTICATED
ACCESS_TOKEN_TYPE_UNSUPPORTED

Error metadata:

method:
google.ai.generativelanguage.v1beta.GenerativeService.StreamGenerateContent

I also manually selected gemini-2.5-pro instead of Auto and the same error occurs.

Environment:
- WSL2 (Ubuntu)
- Node v24.18.0
- Gemini CLI v0.52.0
- Auth Method: gemini-api-key

The API key is valid because direct REST requests work correctly.

### What did you expect to happen?

Gemini CLI should generate responses normally using the configured GEMINI_API_KEY.

### Client information

CLI Version: 0.52.0
Git Commit: d14583b92
Model: Auto
Sandbox: no sandbox
OS: linux
Auth Method: gemini-api-key

### Login information

Authentication methods tested:

- Google Sign-in (previously attempted)
- GEMINI_API_KEY (current)

Current issue occurs while using GEMINI_API_KEY. The CLI reports "Authenticated with gemini-api-key", but every prompt fails with:

401 UNAUTHENTICATED
ACCESS_TOKEN_TYPE_UNSUPPORTED

### Anything else we need to know?

Additional troubleshooting performed:

- Tried authenticating with Google Sign-in.
- Tried authenticating with GEMINI_API_KEY.
- Both authentication methods were tested, but I was unable to successfully use the CLI.
- With GEMINI_API_KEY, the CLI reports "Authenticated with gemini-api-key", but every prompt fails with:

401 UNAUTHENTICATED
ACCESS_TOKEN_TYPE_UNSUPPORTED

- Direct REST API requests using the same API key work correctly (for example, GET /v1beta/models succeeds).
- Environment:
- WSL2 (Ubuntu)
- Node.js v24.18.0
- Gemini CLI v0.52.0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure in Gemini CLI v0.52.0 with Auth Method gemini-api-key on Linux, then trace the request path used for prompts versus the working GET /v1beta/models request. Compare the authentication sent for StreamGenerateContent with the configured GEMINI_API_KEY. Done means prompts generate successfully without ACCESS_TOKEN_TYPE_UNSUPPORTED while direct REST behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, authentication, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.