From 3099114cbb55f3fb5bdbe6ac3631dc14616eeea9 Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Mon, 29 Dec 2025 19:48:02 +0800 Subject: [PATCH] refactor(api): simplify codex id token claims extraction --- .../api/handlers/management/auth_files.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/internal/api/handlers/management/auth_files.go b/internal/api/handlers/management/auth_files.go index d98c759c..e0904ab6 100644 --- a/internal/api/handlers/management/auth_files.go +++ b/internal/api/handlers/management/auth_files.go @@ -454,25 +454,12 @@ func extractCodexIDTokenClaims(auth *coreauth.Auth) gin.H { } result := gin.H{} + if v := strings.TrimSpace(claims.CodexAuthInfo.ChatgptAccountID); v != "" { + result["chatgpt_account_id"] = v + } if v := strings.TrimSpace(claims.CodexAuthInfo.ChatgptPlanType); v != "" { result["plan_type"] = v } - if v := strings.TrimSpace(claims.CodexAuthInfo.UserID); v != "" { - result["user_id"] = v - } - - if len(claims.CodexAuthInfo.Organizations) > 0 { - orgs := make([]gin.H, 0, len(claims.CodexAuthInfo.Organizations)) - for _, org := range claims.CodexAuthInfo.Organizations { - orgs = append(orgs, gin.H{ - "id": strings.TrimSpace(org.ID), - "title": strings.TrimSpace(org.Title), - "role": strings.TrimSpace(org.Role), - "is_default": org.IsDefault, - }) - } - result["organizations"] = orgs - } if len(result) == 0 { return nil