diff --git a/internal/api/handlers/management/auth_files.go b/internal/api/handlers/management/auth_files.go index 342868bc..3794793c 100644 --- a/internal/api/handlers/management/auth_files.go +++ b/internal/api/handlers/management/auth_files.go @@ -1974,7 +1974,7 @@ func (h *Handler) RequestGitHubToken(c *gin.Context) { Type: "github-copilot", } - fileName := fmt.Sprintf("github-%s.json", username) + fileName := fmt.Sprintf("github-copilot-%s.json", username) label := userInfo.Email if label == "" { label = username diff --git a/internal/auth/copilot/copilot_auth.go b/internal/auth/copilot/copilot_auth.go index d702583e..5776648c 100644 --- a/internal/auth/copilot/copilot_auth.go +++ b/internal/auth/copilot/copilot_auth.go @@ -87,9 +87,14 @@ func (c *CopilotAuth) WaitForAuthorization(ctx context.Context, deviceCode *Devi log.Warnf("copilot: failed to fetch user info: %v", err) } + username := userInfo.Login + if username == "" { + username = "github-user" + } + return &CopilotAuthBundle{ TokenData: tokenData, - Username: userInfo.Login, + Username: username, Email: userInfo.Email, Name: userInfo.Name, }, nil