type Github = {
token: string;
};
/**
* Delete an app token
* OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password.
*/
export async function main(
auth: Github,
client_id: string,
body: { access_token: string; [k: string]: unknown }
) {
const url = new URL(`https://api.github.com/applications/${client_id}/token`);
const response = await fetch(url, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 354 days ago
type Github = {
token: string;
};
/**
* Delete an app token
* OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password.
*/
export async function main(
auth: Github,
client_id: string,
body: { access_token: string; [k: string]: unknown }
) {
const url = new URL(
`https://api.github.com/applications/${client_id}/auth.token`
);
const response = await fetch(url, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 359 days ago