Created
November 17, 2024 13:58
-
-
Save thekarel/f4926366bb7cdd20972cb0062cf018de to your computer and use it in GitHub Desktop.
Revoke a GitHub Oauth app grant via REST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will remove the grant, i.e. as if the user never registered with the app. | |
// They will have to go trough the consent screen again | |
await ky | |
.delete(`https://api.github.com/applications/${event.locals.env.AUTH_GITHUB_ID}/grant`, { | |
headers: { | |
Accept: 'application/vnd.github+json', | |
Authorization: `Basic ${btoa(`${event.locals.env.AUTH_GITHUB_ID}:${event.locals.env.AUTH_GITHUB_SECRET}`)}`, | |
'X-GitHub-Api-Version': '2022-11-28', | |
}, | |
json: { | |
access_token: session.user.accessToken, | |
}, | |
}) | |
.catch((error) => { | |
console.error('error in github grant delete', error) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment