Skip to content

Commit 2943955

Browse files
committed
refac
1 parent 715cf97 commit 2943955

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

src/lib/components/AddToolServerModal.svelte

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,20 @@
7878
return;
7979
}
8080
81+
if (auth_type === 'oauth_2.1_static' && (!oauthClientId || !oauthClientSecret)) {
82+
toast.error($i18n.t('Please enter Client ID and Client Secret'));
83+
return;
84+
}
85+
86+
// client_id is the tool server ID (used as the internal lookup key for both flows).
87+
// For static, client_secret signals the backend to use the static credential path.
88+
// The actual OAuth client_id/secret come from the connection info at save time.
8189
const formData: { url: string; client_id: string; client_secret?: string } = {
8290
url: url,
83-
client_id: id
91+
client_id: id,
92+
...(auth_type === 'oauth_2.1_static' ? { client_secret: oauthClientSecret } : {})
8493
};
8594
86-
// For static OAuth, include client credentials
87-
if (auth_type === 'oauth_2.1_static') {
88-
if (!oauthClientId || !oauthClientSecret) {
89-
toast.error($i18n.t('Please enter Client ID and Client Secret'));
90-
return;
91-
}
92-
formData.client_id = id;
93-
formData.client_secret = oauthClientSecret;
94-
}
95-
9695
const res = await registerOAuthClient(localStorage.token, formData, 'mcp').catch((err) => {
9796
toast.error($i18n.t('Registration failed'));
9897
return null;

0 commit comments

Comments
 (0)