fix: 恢复 PR #682 中被误替换为占位符的 OAuth client_secret
PR #682 (release → main 全量同步) 将 Antigravity 和 Gemini CLI 的 OAuth client_secret 硬编码值替换为了 "GOCSPX-your-client-secret" 占位符, 导致未配置环境变量的部署环境中 token 刷新失败。 恢复内容: - antigravity/oauth.go: 恢复真实 client_secret - antigravity/oauth_test.go: 恢复测试断言中的真实值 - geminicli/constants.go: 恢复真实 client_secret
This commit is contained in:
@@ -53,8 +53,7 @@ const (
|
|||||||
var defaultUserAgentVersion = "1.19.6"
|
var defaultUserAgentVersion = "1.19.6"
|
||||||
|
|
||||||
// defaultClientSecret 可通过环境变量 ANTIGRAVITY_OAUTH_CLIENT_SECRET 配置
|
// defaultClientSecret 可通过环境变量 ANTIGRAVITY_OAUTH_CLIENT_SECRET 配置
|
||||||
// 默认值使用占位符,生产环境请通过环境变量注入真实值。
|
var defaultClientSecret = "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"
|
||||||
var defaultClientSecret = "GOCSPX-your-client-secret"
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// 从环境变量读取版本号,未设置则使用默认值
|
// 从环境变量读取版本号,未设置则使用默认值
|
||||||
|
|||||||
@@ -684,7 +684,7 @@ func TestConstants_值正确(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("getClientSecret 应返回默认值,但报错: %v", err)
|
t.Fatalf("getClientSecret 应返回默认值,但报错: %v", err)
|
||||||
}
|
}
|
||||||
if secret != "GOCSPX-your-client-secret" {
|
if secret != "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" {
|
||||||
t.Errorf("默认 client_secret 不匹配: got %s", secret)
|
t.Errorf("默认 client_secret 不匹配: got %s", secret)
|
||||||
}
|
}
|
||||||
if RedirectURI != "http://localhost:8085/callback" {
|
if RedirectURI != "http://localhost:8085/callback" {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ const (
|
|||||||
// They enable the "login without creating your own OAuth client" experience, but Google may
|
// They enable the "login without creating your own OAuth client" experience, but Google may
|
||||||
// restrict which scopes are allowed for this client.
|
// restrict which scopes are allowed for this client.
|
||||||
GeminiCLIOAuthClientID = "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com"
|
GeminiCLIOAuthClientID = "681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com"
|
||||||
GeminiCLIOAuthClientSecret = "GOCSPX-your-client-secret"
|
GeminiCLIOAuthClientSecret = "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"
|
||||||
|
|
||||||
// GeminiCLIOAuthClientSecretEnv is the environment variable name for the built-in client secret.
|
// GeminiCLIOAuthClientSecretEnv is the environment variable name for the built-in client secret.
|
||||||
GeminiCLIOAuthClientSecretEnv = "GEMINI_CLI_OAUTH_CLIENT_SECRET"
|
GeminiCLIOAuthClientSecretEnv = "GEMINI_CLI_OAUTH_CLIENT_SECRET"
|
||||||
|
|||||||
Reference in New Issue
Block a user