Skip to content

Commit

Permalink
/api/v1/integration: filter config param if in response_metadata (#1570)
Browse files Browse the repository at this point in the history
This endpoint is used by the webapp to display provider info when
creating a new connection. When some connection config param is
populated via the token response or redirect metadata we don't need
to show a field for the user to fill in.
  • Loading branch information
TBonnin authored Feb 1, 2024
1 parent b8fb818 commit dfe07c6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/server/lib/controllers/config.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ class ConfigController {
creationDate: config.created_at
};
if (template && template.auth_mode !== AuthModes.App && template.auth_mode !== AuthModes.Custom) {
integration['connectionConfigParams'] = parseConnectionConfigParamsFromTemplate(template!);
integration['connectionConfigParams'] = parseConnectionConfigParamsFromTemplate(template!).filter(
// we ignore connection config params that are in the token response metadata or redirect url metadata
(element) => [...(template.token_response_metadata || []), ...(template.redirect_uri_metadata || [])].indexOf(element) == -1
);
}
return integration;
});
Expand Down

0 comments on commit dfe07c6

Please sign in to comment.