//native
type Clerk = {
apiKey: string;
};
/**
* Delete External Account
* Delete an external account by ID.
*/
export async function main(
auth: Clerk,
user_id: string,
external_account_id: string,
) {
const url = new URL(
`https://api.clerk.com/v1/users/${user_id}/external_accounts/${external_account_id}`,
);
const response = await fetch(url, {
method: "DELETE",
headers: {
Authorization: "Bearer " + auth.apiKey,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago