[GH-ISSUE #182] gemini-cli-oauth生成授权不成功 #139

Closed
opened 2026-02-27 07:18:11 +03:00 by kerem · 10 comments
Owner

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
这个是我哪里设置的不对吗

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 这个是我哪里设置的不对吗
kerem closed this issue 2026-02-27 07:18:11 +03:00
Author
Owner

@justlovemaki commented on GitHub (Jan 8, 2026):

http://192.168.1.6:8085 在你服务器上不能正常访问,要么端口没开,要么你操作授权太久了,监听程序自动关闭了

<!-- gh-comment-id:3722755060 --> @justlovemaki commented on GitHub (Jan 8, 2026): http://192.168.1.6:8085 在你服务器上不能正常访问,要么端口没开,要么你操作授权太久了,监听程序自动关闭了
Author
Owner

@justlovemaki commented on GitHub (Jan 8, 2026):

试试新版

<!-- gh-comment-id:3722845333 --> @justlovemaki commented on GitHub (Jan 8, 2026): 试试新版
Author
Owner

@ariesljm commented on GitHub (Jan 8, 2026):

我升级了新版了,生成授权后出google账号授权后显示无法访问,把完整url复制进去后就在那个页面不会动了,我的服务器是部署在局域网里,我查看流量端口也都是打开的

<!-- gh-comment-id:3722933502 --> @ariesljm commented on GitHub (Jan 8, 2026): 我升级了新版了,生成授权后出google账号授权后显示无法访问,把完整url复制进去后就在那个页面不会动了,我的服务器是部署在局域网里,我查看流量端口也都是打开的
Author
Owner

@ariesljm commented on GitHub (Jan 8, 2026):

Image Image
<!-- gh-comment-id:3722941354 --> @ariesljm commented on GitHub (Jan 8, 2026): <img width="613" height="793" alt="Image" src="https://github.com/user-attachments/assets/7bb0b15f-0890-4bf5-aaed-4240bf47a072" /> <img width="554" height="586" alt="Image" src="https://github.com/user-attachments/assets/32c418e4-0eea-43d4-b53d-494a3f13abc8" />
Author
Owner

@justlovemaki commented on GitHub (Jan 8, 2026):

要看日志

<!-- gh-comment-id:3722948839 --> @justlovemaki commented on GitHub (Jan 8, 2026): 要看日志
Author
Owner

@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 errorRedactor option in gaxios for configuration>.',
'redirect_uri' => 'http://localhost:8085',
'client_secret' => '< - See errorRedactor option in gaxios for 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 errorRedactor option in gaxios for configuration>.',
'redirect_uri' => 'http://localhost:8085',
'client_secret' => '< - See errorRedactor option in gaxios for 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'
}
}
显示似乎是连接问题,我也设置好了代理

<!-- gh-comment-id:3723036717 --> @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.<anonymous> (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' => '<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.', 'redirect_uri' => 'http://localhost:8085', 'client_secret' => '<<REDACTED> - See `errorRedactor` option in `gaxios` for 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' => '<<REDACTED> - See `errorRedactor` option in `gaxios` for configuration>.', 'redirect_uri' => 'http://localhost:8085', 'client_secret' => '<<REDACTED> - See `errorRedactor` option in `gaxios` for 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.<anonymous> (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.<anonymous> (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' } } 显示似乎是连接问题,我也设置好了代理
Author
Owner

@justlovemaki commented on GitHub (Jan 8, 2026):

FetchError: request to https://oauth2.googleapis.com/token ,内网访问不了google,无能为力

<!-- gh-comment-id:3723056485 --> @justlovemaki commented on GitHub (Jan 8, 2026): FetchError: request to https://oauth2.googleapis.com/token ,内网访问不了google,无能为力
Author
Owner

@ariesljm commented on GitHub (Jan 8, 2026):

你好,我在docker里加了HTTPS_PROXY的环境变量,gemini-cli-oauth可以用了,感谢作者

<!-- gh-comment-id:3724336131 --> @ariesljm commented on GitHub (Jan 8, 2026): 你好,我在docker里加了HTTPS_PROXY的环境变量,gemini-cli-oauth可以用了,感谢作者
Author
Owner

@justlovemaki commented on GitHub (Jan 8, 2026):

你好,我在docker里加了HTTPS_PROXY的环境变量,gemini-cli-oauth可以用了,感谢作者

这个配置管理有可视化配置的地方

<!-- gh-comment-id:3724508580 --> @justlovemaki commented on GitHub (Jan 8, 2026): > 你好,我在docker里加了HTTPS_PROXY的环境变量,gemini-cli-oauth可以用了,感谢作者 这个配置管理有可视化配置的地方
Author
Owner

@ariesljm commented on GitHub (Jan 8, 2026):

在可视化配置里配置了代理生成授权不成功,设置了环境变量后,生成授权就成功可以用了,不好意思,我是小白,我问的ai告诉我的

<!-- gh-comment-id:3724522117 --> @ariesljm commented on GitHub (Jan 8, 2026): 在可视化配置里配置了代理生成授权不成功,设置了环境变量后,生成授权就成功可以用了,不好意思,我是小白,我问的ai告诉我的
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#139
No description provided.