mkmarek commented on PR #5077: URL: https://github.com/apache/incubator-devlake/pull/5077#issuecomment-1536143359
Yeah pretty much. It's possible to fetch the installation ID based on `owner/repo`. It's also possible to fetch all installations and then pick the correct one just based on `owner`. Or if you know if the `owner` is either org or user there are endpoints for fetching the token directly just based on `owner`. I have made an alternative version of the code. I haven't cleaned it up properly yet. But I can push it now. It removes the if-elses in the impl and api parts and moves everything to `connection.go` using multiauth. What I got left with in the `impl` and `api` files is the minimum that is needed to provide for the connection to work. I took a bit different approach where it initially fetches tokens for all the installations in the `PrepareApiClient` function and then uses the tokens in `SetupAuthentication` based on either a installationid or a repository. The installationid and the repository have to be provided from the outside. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
