From 24e8e018e5dd504a39be9a8376638209d27a2b17 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 15 Nov 2024 11:06:00 +0100 Subject: [PATCH] feat(integrations): verify a credentials after saving them to db --- backend/pkg/integrations/service.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/pkg/integrations/service.go b/backend/pkg/integrations/service.go index cc26cd1b1..5bcac2ec5 100644 --- a/backend/pkg/integrations/service.go +++ b/backend/pkg/integrations/service.go @@ -53,6 +53,11 @@ func (s *serviceImpl) AddIntegration(projectID uint64, provider string, data int if err := s.conn.Exec(sql, projectID, provider, data); err != nil { return fmt.Errorf("failed to add integration: %v", err) } + // Check that provided credentials are valid + _, err := s.fetchSessionData(provider, data, 0) + if err != nil { + return fmt.Errorf("failed to validate provider credentials: %v", err) + } return nil }