Skip to content

Windows 下 Google Gemini 认证失败:client_secret missing 与 400 错误

来源:GitHub #30403

问题

在 Windows 11 环境下,使用 openclaw models auth google 尝试进行 OAuth 认证时失败。由于 google-antigravity-auth 插件已被移除,google-gemini-cli-auth 成为唯一可用的 Google 模型认证路径,但在执行认证时抛出以下错误:

Failed to get auth: missing client_secret
loadCodeAssist 400 Bad Request

解决方案

该问题是由于 Windows 环境下的路径解析与 OAuth 客户端凭据管理导致的。

目前有一个变通方案(Workaround):改用 API Key 而不是 OAuth 进行认证。

  1. 前往 Google AI Studio 申请一个 API Key。
  2. 在 OpenClaw 中直接配置该 Key:
bash
openclaw config set providers.google.apiKey "你的_API_KEY"

这会跳过整个 OAuth 流程,直接通过 API Key 使用 Gemini 模型,从而避开 Windows 上的 OAuth 崩溃问题。