From cda688b67e7c2dee69e783c99e707968f29b5aa3 Mon Sep 17 00:00:00 2001 From: "zenix.huang" Date: Thu, 12 Feb 2026 17:34:10 +0900 Subject: [PATCH] fix: interval in json should be a string --- pkg/auth/oauth.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/auth/oauth.go b/pkg/auth/oauth.go index 94a79a68f..e2e14df83 100644 --- a/pkg/auth/oauth.go +++ b/pkg/auth/oauth.go @@ -13,6 +13,7 @@ import ( "net/url" "os/exec" "runtime" + "strconv" "strings" "time" ) @@ -137,21 +138,22 @@ func LoginDeviceCode(cfg OAuthProviderConfig) (*AuthCredential, error) { var deviceResp struct { DeviceAuthID string `json:"device_auth_id"` UserCode string `json:"user_code"` - Interval int `json:"interval"` + Interval string `json:"interval"` } if err := json.Unmarshal(body, &deviceResp); err != nil { return nil, fmt.Errorf("parsing device code response: %w", err) } + interval, _ := strconv.Atoi(deviceResp.Interval) - if deviceResp.Interval < 1 { - deviceResp.Interval = 5 + if interval < 1 { + interval = 5 } fmt.Printf("\nTo authenticate, open this URL in your browser:\n\n %s/codex/device\n\nThen enter this code: %s\n\nWaiting for authentication...\n", cfg.Issuer, deviceResp.UserCode) deadline := time.After(15 * time.Minute) - ticker := time.NewTicker(time.Duration(deviceResp.Interval) * time.Second) + ticker := time.NewTicker(time.Duration(interval) * time.Second) defer ticker.Stop() for {