You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Installation.get_repos needs to differentiate between IAT access and UAT access #3546
get_repos calls /installation/repositories. This is the correct endpoint when the Installation was created from an IAT (or an app, which pygithub handles and upgrades internally).
However if the Installation was obtained via a user access token e.g. AuthenticatedUser.get_installations, then this triggers an HTTP 403 error, the correct endpoint is /user/installations/{installation_id}/repositories.
Sadly one can not even use the repositories_url which is returned as part of the installation object, because it's apparently hardcoded to /installation/repositories (note that it is not currently used by the code anyway, get_repos hard-codes that URL separately).
I can see two places to handle this, both by checking if the auth is AppUserAuth:
lazily in get_repos, and switch to the user version
or eagerly in __init__, after checking for AppAuth check for AppUserAuth, and update the _repositories_url (if necessary, in case github eventually fixes this?), and update get_repos to access self.repostories_url
Activity
Fix listing installation repositories with user authentication (PyGit…