//native
type Clerk = {
apiKey: string;
};
/**
* Create a SAML Connection
* Create a new SAML Connection.
*/
export async function main(
auth: Clerk,
body: {
name: string;
domain: string;
provider: "saml_custom" | "saml_okta" | "saml_google" | "saml_microsoft";
idp_entity_id?: string;
idp_sso_url?: string;
idp_certificate?: string;
idp_metadata_url?: string;
idp_metadata?: string;
organization_id?: string;
attribute_mapping?: {
user_id?: string;
email_address?: string;
first_name?: string;
last_name?: string;
};
},
) {
const url = new URL(`https://api.clerk.com/v1/saml_connections`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago