1 | |
2 | type Clerk = { |
3 | apiKey: string; |
4 | }; |
5 | |
6 | * Update a SAML Connection |
7 | * Updates the SAML Connection whose ID matches the provided `id` in the path. |
8 | */ |
9 | export async function main( |
10 | auth: Clerk, |
11 | saml_connection_id: string, |
12 | body: { |
13 | name?: string; |
14 | domain?: string; |
15 | idp_entity_id?: string; |
16 | idp_sso_url?: string; |
17 | idp_certificate?: string; |
18 | idp_metadata_url?: string; |
19 | idp_metadata?: string; |
20 | organization_id?: string; |
21 | attribute_mapping?: { |
22 | user_id?: string; |
23 | email_address?: string; |
24 | first_name?: string; |
25 | last_name?: string; |
26 | }; |
27 | active?: false | true; |
28 | sync_user_attributes?: false | true; |
29 | allow_subdomains?: false | true; |
30 | allow_idp_initiated?: false | true; |
31 | disable_additional_identifications?: false | true; |
32 | }, |
33 | ) { |
34 | const url = new URL( |
35 | `https://api.clerk.com/v1/saml_connections/${saml_connection_id}`, |
36 | ); |
37 |
|
38 | const response = await fetch(url, { |
39 | method: "PATCH", |
40 | headers: { |
41 | "Content-Type": "application/json", |
42 | Authorization: "Bearer " + auth.apiKey, |
43 | }, |
44 | body: JSON.stringify(body), |
45 | }); |
46 | if (!response.ok) { |
47 | const text = await response.text(); |
48 | throw new Error(`${response.status} ${text}`); |
49 | } |
50 | return await response.json(); |
51 | } |
52 |
|