//native
type Clerk = {
apiKey: string;
};
/**
* Revoke the given sign-in token
* Revokes a pending sign-in token
*/
export async function main(auth: Clerk, sign_in_token_id: string) {
const url = new URL(
`https://api.clerk.com/v1/sign_in_tokens/${sign_in_token_id}/revoke`,
);
const response = await fetch(url, {
method: "POST",
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