pksunkara / octonode

github api v3 in nodejs
MIT License
1.19k stars 237 forks source link

Using intallations and Github App private key authentication #308

Open migsar opened 6 years ago

migsar commented 6 years ago

I am trying to use octonode for developing a Github App, is there a way to use a private key for auth and the access_tokens endpoint?

I want to use the createContents method.

pksunkara commented 6 years ago

I am sorry I don't understand your question. Can you explain more?

migsar commented 6 years ago

Sure, sorry, this is my first time using your library so I hope I am not asking for something obvious. When creating a GitHub App instead of an OAuth App or using Personal access tokens Github creates a public-private key, they keep the public part and let you download the private part, then you have to use that private key file (a pem with PKCS#1 RSAPrivateKey format) and then that key is used to get a Bearer token and make a POST request to /installations/:installation_id/access_tokens to get a new token that you can use for hitting the v3 API.

I want to follow that flow in my application but I could not find a way to build a client with a private key (the pem file), I also thought about creating that Bearer token in my own code and later using it to get the access_tokens, but did not found docs about that either. Is it possible to build the client this way or what is the recommended path to follow for this kind of application? Thanks.

pksunkara commented 6 years ago

I am sorry, nothing like that is supported. Github App is something that had been released in the last year.

migsar commented 6 years ago

Ok, thanks anyway, it is a suberb library!

I'll use the other auth methods for now and try to write a custom solution for that, I would love to collaborate to this project but I don't thing I got the skills nor the time for now.