diff --git a/components/backend/handlers/integrations_status.go b/components/backend/handlers/integrations_status.go index 848917a19..649c30845 100644 --- a/components/backend/handlers/integrations_status.go +++ b/components/backend/handlers/integrations_status.go @@ -3,7 +3,6 @@ package handlers import ( "context" "net/http" - "time" "github.com/gin-gonic/gin" ) @@ -63,13 +62,13 @@ func getGitHubStatusForUser(ctx context.Context, userID string) gin.H { // Check GitHub PAT patCreds, err := GetGitHubPATCredentials(ctx, userID) if err == nil && patCreds != nil { - // Validate PAT token - valid, _ := ValidateGitHubToken(ctx, patCreds.Token) + // NOTE: Validation disabled - if credentials are stored, assume they're valid + // The integration will fail gracefully if credentials are actually invalid status["pat"] = gin.H{ "configured": true, "updatedAt": patCreds.UpdatedAt.Format("2006-01-02T15:04:05Z07:00"), - "valid": valid, + "valid": true, } } @@ -89,19 +88,15 @@ func getGoogleStatusForUser(ctx context.Context, userID string) gin.H { return gin.H{"connected": false} } - // Check if token is expired - isExpired := time.Now().After(creds.ExpiresAt) - valid := !isExpired - - // If near expiry, could validate with Google API, but checking expiry is sufficient - // since backend auto-refreshes tokens + // NOTE: Validation disabled - if credentials are stored, assume they're valid + // The backend auto-refreshes tokens and the integration will fail gracefully if invalid return gin.H{ "connected": true, "email": creds.Email, "expiresAt": creds.ExpiresAt.Format("2006-01-02T15:04:05Z07:00"), "updatedAt": creds.UpdatedAt.Format("2006-01-02T15:04:05Z07:00"), - "valid": valid, + "valid": true, } } @@ -131,13 +126,13 @@ func getGitLabStatusForUser(ctx context.Context, userID string) gin.H { return gin.H{"connected": false} } - // Validate token - valid, _ := ValidateGitLabToken(ctx, creds.Token, creds.InstanceURL) + // NOTE: Validation disabled - if credentials are stored, assume they're valid + // The integration will fail gracefully if credentials are actually invalid return gin.H{ "connected": true, "instanceUrl": creds.InstanceURL, "updatedAt": creds.UpdatedAt, - "valid": valid, + "valid": true, } } diff --git a/components/backend/main.go b/components/backend/main.go index 59b997eaa..39c3d5c52 100644 --- a/components/backend/main.go +++ b/components/backend/main.go @@ -94,13 +94,25 @@ func main() { // Initialize git package git.GetProjectSettingsResource = k8s.GetProjectSettingsResource git.GetGitHubInstallation = func(ctx context.Context, userID string) (interface{}, error) { - return github.GetInstallation(ctx, userID) + installation, err := github.GetInstallation(ctx, userID) + if installation == nil { + return nil, err + } + return installation, err } git.GetGitHubPATCredentials = func(ctx context.Context, userID string) (interface{}, error) { - return handlers.GetGitHubPATCredentials(ctx, userID) + creds, err := handlers.GetGitHubPATCredentials(ctx, userID) + if creds == nil { + return nil, err + } + return creds, err } git.GetGitLabCredentials = func(ctx context.Context, userID string) (interface{}, error) { - return handlers.GetGitLabCredentials(ctx, userID) + creds, err := handlers.GetGitLabCredentials(ctx, userID) + if creds == nil { + return nil, err + } + return creds, err } git.GitHubTokenManager = github.Manager git.GetBackendNamespace = func() string {