Create repo from template repo using a GIthub APP

I’ve trying to create a new repo from a template with my github app credentials, but even though I have administration permissions granted with the app, I’m getting the infamous Resource not accessible by integration response.

Code snippet for the request:

const res = await request(
        `POST /repos/carmon/til-template/generate`,
        {
          headers: {
            accept: 'application/vnd.github.baptiste-preview+json', // needed while endpoint is still in preview
            authorization: `bearer ${botToken}`
          }, 
          data: {
            owner,
            name
          }
        }
      )

That botToken is an access_token made with an installation id.

Maybe this is not implemented for github apps ATM, so I’m just passing to check that.
Thanks in advance.

1 Like

Hi there @carmon :wave:

Thanks so much for joining the Community, and for your post!

When you suggested, that:

Maybe this is not implemented for github apps

…you were spot-on.

Currently, GitHub Apps can’t use the template endpoint, as you can with a PAT, or as an OAuth App. For this, I’d highly recommend submitting your request via our feedback form:

…for review and consideration.

In the meantime, is authenticating as an OAuth app, an option for you?

You might have security concerns around this though, so maybe this doesn’t work for your use case.

1 Like

Thank you very much for the reply!

I’ll submit the feedback and try the oauth app authentication method :slightly_smiling_face:

1 Like