How to authenticate Octokit using Github Oauth access_token
Asked Answered
M

0

7

I'm building a GitHub Oauth app, and I'm trying to authenticate Octokit using an Oauth access_token that I'm getting when the user clicks sign in with Github.

The access_token I'm using has access to the repo scope, but when I try to authenticate Octokit with this token, I get: HttpError: A JSON web token could not be decoded

Here is my code:

let TOKEN = "<Token>"

const appOctokit = new Octokit({
    auth: TOKEN
});

I've also tried authenticating like this:

const appOctokit = new Octokit({
        authStrategy: createOAuthAppAuth,
        auth: {
            clientId: "<Client_ID>",
            clientSecret: "<Client_Secret>",
        },
});

but when I do that, and I try deleting an issue using octokit, I get an HttpError: Not Found error.

Moramorabito answered 1/8, 2021 at 20:2 Comment(1)
did you find a solution ? I think I'm trying to do the same thingRodent

© 2022 - 2024 — McMap. All rights reserved.