//native
type Kustomer = {
apiKey: string;
};
/**
* Update Auth Settings
* Updates authentication settings for the organization
#### NOTE
>Requires **org.admin.security** privileges
*/
export async function main(
auth: Kustomer,
body: {
kustomer: { enabled: false | true };
google: { enabled: false | true };
saml?: {
idpPublicCerts?: string[];
idpLoginUrl?: string;
idpLogoutUrl?: string;
idpIssuerId?: string;
forceAuth?: false | true;
signRequests?: false | true;
allowUnencryptedAssert?: false | true;
enabled: false | true;
};
app?: { userSessionExpirationMilliseconds?: number };
},
) {
const url = new URL(`https://api.kustomerapp.com/v1/auth/settings`);
const response = await fetch(url, {
method: "PUT",
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 235 days ago