//native
type Clerk = {
apiKey: string;
};
/**
* Add identifier to the allow-list
* Create an identifier allowed to sign up to an instance
*/
export async function main(
auth: Clerk,
body: { identifier: string; notify?: false | true },
) {
const url = new URL(`https://api.clerk.com/v1/allowlist_identifiers`);
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