Question on general flow for apps
tnolet opened this issue · 3 comments
Hi, Octokit is great. That first.
Just a short question on general flow for SaaS apps that integrate Github Apps. I'm building https://checklyhq.com and have a use case for users installing my Github App and my SaaS taking action on certain webhooks.
-
User installs app. This I have figured out. I redirect the user to the Github hosted install page and get a callback on a URL.
-
The URL contains the installation_id of the app. This is important. I save this in the user's profile in my database.
-
Some time later, or directly after, the user navigates in my SaaS app and needs to select a repo in his/her account he/she wants to use as a trigger for actions in my SaaS.
For this, I need to list the user's repos. I can do this with octokit.repos.listForUser()
but I need the username for this to work. I don't have that.
Do I need to explicitly fetch the username / owner associated with the installation_id or is there some quick other way I have missed?
P.S. I can do this, I can fetch all data using JWT and InstallationID tokens. Works all fine. Just seems a lot of work...
I think what you are looking for is to list repositories for an installation?
https://octokit.github.io/rest.js/#octokit-routes-apps-list-repos
You could list all repositories of all installations that you stored in the repository profile and list these
@gr2m Boom 💥. That's it. Thanks so much for the swift answer.
Just getting to grips with the various Github auth schemes and who/what can do what in which situation.
happy to help :)