0

I am developing a web application were I require to create a repository on user's github account using github app and oauth access token but I am getting 403 error when making a post request

error: Resources not accessible by integration

router.post('/create_repo', async (req, res) => {
    try {
        const { access_token } = req.session.github?.token
        const { name, description } = req.body

        if (!name) return res.sendStatus(422)

        const octokit = new Octokit({
            auth: access_token
        })

        const response = await octokit.request('POST /user/repos', {
            name,
            description: 'This is your first repo!',
            homepage: 'https://github.com',
            private: false,
            headers: {
                'X-GitHub-Api-Version': '2022-11-28'
            }
        })

        res.status(200).json(response.data)

    } catch (error) {
        res.sendStatus(500)
    }
})

I also have added scopes as repo and public_repo in the url of the consent screen

0 Answers0