mirror of
https://github.com/justlovemaki/AIClient-2-API.git
synced 2026-04-26 09:55:54 +03:00
[GH-ISSUE #182] gemini-cli-oauth生成授权不成功 #139
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/AIClient-2-API-justlovemaki#139
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ariesljm on GitHub (Jan 8, 2026).
Original GitHub issue: https://github.com/justlovemaki/AIClient-2-API/issues/182
我设置了代理服务器,使用生成授权后返回:无法访问,我将该页面的完整url填入自动监听受阻的下面对话框中,提交后页面没有反应,我查看日志:
Server] Received request: GET http://localhost:3000/health
[OAuth Manual Callback] Processing manual callback for gemini-cli-oauth
[OAuth Manual Callback] Callback URL: http://192.168.1.6:8085/?code=4/0ATX87lMSgVx9xEUJlAv_Xm1mzciQ389uqksiOrdjD4lBAqXRGGyVooQoteX1aY14YKxQ&scope=https://www.googleapis.com/auth/cloud-platform
[Gemini Auth] 收到来自 Google 的成功回调: /?code=4/0ATX87lMSgVx9xEUJlAv_Xm1mzciQ389uqksiOrdjD4lBXRO9GGyVooQoteX1aY14YKxQ&scope=https://www.googleapis.com/auth/cloud-platform
[Server] Received request: GET http://localhost:3000/health
[OAuth Manual Callback] Failed to process callback: TypeError: fetch failed
at node:internal/deps/undici/undici:14900:13
at async handleUIApiRequests (file:///app/src/ui-manager.js:1519:34)
at async Server.requestHandler (file:///app/src/request-handler.js:62:27) {
[cause]: HeadersTimeoutError: Headers Timeout Error
at FastTimer.onParserTimeout [as _onTimeout] (node:internal/deps/undici/undici:6363:32)
at Timeout.onTick [as _onTimeout] (node:internal/deps/undici/undici:2326:17)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7) {
code: 'UND_ERR_HEADERS_TIMEOUT',
[Symbol(undici.error.UND_ERR)]: true,
[Symbol(undici.error.UND_ERR_HEADERS_TIMEOUT)]: true
这个是我哪里设置的不对吗
@justlovemaki commented on GitHub (Jan 8, 2026):
http://192.168.1.6:8085 在你服务器上不能正常访问,要么端口没开,要么你操作授权太久了,监听程序自动关闭了
@justlovemaki commented on GitHub (Jan 8, 2026):
试试新版
@ariesljm commented on GitHub (Jan 8, 2026):
我升级了新版了,生成授权后出google账号授权后显示无法访问,把完整url复制进去后就在那个页面不会动了,我的服务器是部署在局域网里,我查看流量端口也都是打开的
@ariesljm commented on GitHub (Jan 8, 2026):
@justlovemaki commented on GitHub (Jan 8, 2026):
要看日志
@ariesljm commented on GitHub (Jan 8, 2026):
[Gemini Auth] 获取令牌失败: GaxiosError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT 142.250.99.95:443
at Gaxios._request (/app/node_modules/gaxios/build/cjs/src/gaxios.js:164:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async OAuth2Client.getTokenAsync (/app/node_modules/google-auth-library/build/src/auth/oauth2client.js:205:21)
at async Server. (file:///app/src/oauth-handlers.js:222:44) {
config: {
retry: true,
retryConfig: {
httpMethodsToRetry: [Array],
currentRetryAttempt: 2,
retry: 3,
noResponseRetries: 2,
retryDelayMultiplier: 2,
timeOfFirstRequest: 1767863543527,
totalTimeout: 9007199254740991,
maxRetryDelay: 9007199254740991,
statusCodesToRetry: [Array]
},
method: 'POST',
url: URL {
href: 'https://oauth2.googleapis.com/token',
origin: 'https://oauth2.googleapis.com',
protocol: 'https:',
username: '',
password: '',
host: 'oauth2.googleapis.com',
hostname: 'oauth2.googleapis.com',
port: '',
pathname: '/token',
search: '',
searchParams: URLSearchParams {},
hash: ''
},
data: URLSearchParams {
'client_id' => '681255809395-oo8ft2oprdrnp9e3v3hmdib135j.apps.googleusercontent.com',
'code' => '4/0ATX87lN1_ZmMWwrlPQHvWFq30mdSb-0XfCjqP35W-W_ffura_WRpPXYEkb6qoS52BQ',
'grant_type' => '< - See
errorRedactoroption ingaxiosfor configuration>.','redirect_uri' => 'http://localhost:8085',
'client_secret' => '< - See
errorRedactoroption ingaxiosfor configuration>.' },headers: Headers {
'x-goog-api-client': 'gl-node/20.19.6',
'User-Agent': 'google-api-nodejs-client/10.1.0'
},
body: URLSearchParams {
'client_id' => '681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com',
'code' => '4/0ATX87lN1_ZmMWwrlPQHvWFq30mdSb-0XfCjqP35LGAAW-W_ffura_WRpPXYEkb6qoS52BQ',
'grant_type' => '< - See
errorRedactoroption ingaxiosfor configuration>.','redirect_uri' => 'http://localhost:8085',
'client_secret' => '< - See
errorRedactoroption ingaxiosfor configuration>.' },validateStatus: [Function: validateStatus],
responseType: 'unknown',
errorRedactor: [Function: defaultErrorRedactor],
duplex: 'half'
},
response: undefined,
code: 'ETIMEDOUT',
status: undefined,
error: FetchError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT 142.250.99.95:443
at ClientRequest. (file:///app/node_modules/node-fetch/src/index.js:108:11)
at ClientRequest.emit (node:events:536:35)
at emitErrorEvent (node:_http_client:101:11)
at TLSSocket.socketErrorListener (node:_http_client:504:5)
at TLSSocket.emit (node:events:524:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
erroredSysCall: 'connect'
},
[Symbol(gaxios-gaxios-error)]: '7.1.1',
[cause]: FetchError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT 142.250.99.95:443
at ClientRequest. (file:///app/node_modules/node-fetch/src/index.js:108:11)
at ClientRequest.emit (node:events:536:35)
at emitErrorEvent (node:_http_client:101:11)
at TLSSocket.socketErrorListener (node:_http_client:504:5)
at TLSSocket.emit (node:events:524:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
erroredSysCall: 'connect'
}
}
显示似乎是连接问题,我也设置好了代理
@justlovemaki commented on GitHub (Jan 8, 2026):
FetchError: request to https://oauth2.googleapis.com/token ,内网访问不了google,无能为力
@ariesljm commented on GitHub (Jan 8, 2026):
你好,我在docker里加了HTTPS_PROXY的环境变量,gemini-cli-oauth可以用了,感谢作者
@justlovemaki commented on GitHub (Jan 8, 2026):
这个配置管理有可视化配置的地方
@ariesljm commented on GitHub (Jan 8, 2026):
在可视化配置里配置了代理生成授权不成功,设置了环境变量后,生成授权就成功可以用了,不好意思,我是小白,我问的ai告诉我的