Merge pull request #877 from zhiqing0205/main

feat(codex): include plan type in auth filename
This commit is contained in:
Luis Pater
2026-01-20 11:11:25 +08:00
committed by GitHub
3 changed files with 67 additions and 3 deletions

View File

@@ -191,7 +191,13 @@ waitForCallback:
return nil, fmt.Errorf("codex token storage missing account information")
}
fileName := fmt.Sprintf("codex-%s.json", tokenStorage.Email)
planType := ""
if tokenStorage.IDToken != "" {
if claims, errParse := codex.ParseJWTToken(tokenStorage.IDToken); errParse == nil && claims != nil {
planType = strings.TrimSpace(claims.CodexAuthInfo.ChatgptPlanType)
}
}
fileName := codex.CredentialFileName(tokenStorage.Email, planType, true)
metadata := map[string]any{
"email": tokenStorage.Email,
}