feat(integrations): verify a credentials after saving them to db

This commit is contained in:
Alexander 2024-11-15 11:06:00 +01:00
parent eb7e7de463
commit 24e8e018e5

View file

@ -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
}