Search code examples
githubgithub-api

Github API v3 -- required permissions for managing deploy keys?


I have a Github App set up using their v3 API. I am successfully authenticating and I can create and modify repositories. I'm trying to also attach a deploy key to a newly created repository. However, I'm getting 403: Resource not accessible by integration -- this is regardless of whether I try to read or write the keys. The app is installed on the organization, and the repository is also owned by that same org.

The api documentation gives routes for managing deploy keys: https://developer.github.com/v3/repos/keys/#add-a-new-deploy-key

But the permissions list doesn't mention deploy keys at all: https://developer.github.com/v3/apps/permissions/#permission-on-administration

I have turned on Read & Write access for Repository Administration, Repository Contents, and Repository Projects in the permissions for the app, but I'm still getting this access error.


Solution

  • That endpoint hasn't been enabled for GitHub Apps yet -- you can only use it with OAuth tokens currently (or Basic Auth).

    I recommend requesting that this be added for GitHub Apps over on the Platform forum for Apps:

    https://platform.github.community/c/integrations

    That's the best place to ask questions and provide feedback about GitHub Apps (GitHub staff monitors that forum and answers questions).