How to use Github API to revoke OAuth authentication?

Here is the code I’m using, but I keep getting a 403 error in response.

let username = "CLIENT_ID_GOES_HERE";
let password = "SECRET_GOES_HERE";
let basicAuth = Buffer.from(`${username}:${password}`).toString('base64');

try {
    response = await axios.delete(`${clientId}/grant`, 
        headers: {
            'Authorization': `Basic ${basicAuth}`,
            'Accept': 'application/vnd.github.v3+json',
        data: {
            access_token: token
} catch (e) {
    return {
        statusCode: 502,
        body: JSON.stringify(e)

I’ve verified that the client ID, secret and token are all correct. The token I’m using is the one that is returned by github upon authenticating.

I figured it out. First, I had to modify my axios request to be able to see the full error message. Inside the ‘catch’ part of a try-catch, I was able to take a look at the value of

The error I was getting was “Cookies must be enabled to use github”.

After some Googling, someone with the same error commented that they had to use the host Turns out that I was using Once I changed this, the error went away.