How to create Github App and keep sanity

gvidon
ottofeller
Published in
2 min readNov 27, 2018

Github Apps were announced a long time ago, but still the connection of Github App to user’s repos for those who creates Github App for the first time may seem very unclear, complicated and sometimes illogical. The reason is that official docs never focus on few important subtle things which allow to understand the difference between traditional approach of delegating user permission through OAuth and relatively modern approach of Github Apps.

What happens after user connects Github App to a repo(s)?

After being installed Github App will start to receive web hooks from all connected repo(s).

Installation is an integral part of Github App, I will explain it later. Web hooks events which are sent to a Github App are strictly defined in a Github App settings, and before connecting a Github App, user will be asked for granting permissions to the Github App to receive these web hooks events.

How is it different from traditional OAuth approach? Before Github Apps appeared, you as an app developer had to manually set up web hook URL to every user’s repo. Now you don’t have to. The single web hook is setup for all connected repos.

Another difference is how a Github App interacts with your repos. Let’s talk about installations.

What is the installation?

Github App installation is sort of a bot which you grant permissions to interact with your personal or organisational repositories.

Using OAuth token, installations can interact with exact the same API you can interact using your personal token, though the process of acquiring of installation OAuth token is different (it is very well covered in official docs).

The difference in approach of Github Apps and the older one approach is that with Github Apps all actions with any entity of the Github are performed by installation, and installation will be shown everywhere as the performer of an action. For example, if it is allowed it can put comments to an issue and all such comments will have Github App name shown as user name and Github App logo shown as user picture.

Try it!

I would be glad to know that this article gave a good insight on how Github Apps work! And now that you can put all pieces of the puzzle together you can try official example from https://developer.github.com/apps/building-your-first-github-app/

OttoFeller is the software development company specialising in front end of complex web applications and in promising cutting edge technologies.

--

--