Skip to content

Commit

Permalink
chore(integration): allow only OAuth connections once that method is …
Browse files Browse the repository at this point in the history
…supported
  • Loading branch information
jvallesm committed Oct 4, 2024
1 parent f5663cf commit 0137e98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion integration-test/pipeline/rest-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ export function CheckConnections(data) {
pipelinePublicHost + path,
JSON.stringify({
id: connectionID,
integrationId: integrationID,
// Needs to be an integration that doesn't support OAuth. Once it's
// supported, it's the only method allowed.
integrationId: "asana",
method: "METHOD_DICTIONARY",
setup: setup,
}),
Expand Down
3 changes: 3 additions & 0 deletions pkg/service/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ func (s *service) validateConnection(conn *pb.Connection, integration *pb.Integr
switch conn.GetMethod() {
case pb.Connection_METHOD_DICTIONARY:
err := fmt.Errorf("%w: invalid payload in dictionary connection", errdomain.ErrInvalidArgument)
if integration.GetOAuthConfig() != nil {
return errmsg.AddMessage(err, integration.GetTitle()+" connection only accepts METHOD_OAUTH.")
}
if len(conn.GetScopes()) > 0 {
return errmsg.AddMessage(err, "Scopes only apply to OAuth connections.")
}
Expand Down

0 comments on commit 0137e98

Please sign in to comment.