1

According to this post, I should be able to generate a personal access token under my profile that has access to an organization's private repo, and use this personal access token for authentication to access an organization's private repo via Github-api.

However, when using this token, I get a 401 Unauthorized response / "Bad credentials". Is there extra permissions needed for my profile in order to use the Github API on that organization's private repo? Is there scopes I should have checked off when making my personal access token in order for it to work? My profile has the permission to read and contribute to the org repo, so I am confused why my profile's access token is met with a 401.

I ultimately want to run GET {{root}}/repos/{{owner}}/{{repo}}/contents/, where the owner is the organization name. Oddly, when using my personal access token on my own forked copies of the organization's repo, I also get a 401 Unauthorized.

EDIT: I checked off all possible scopes to attach to a token. Even with this token, I still get a 401 "Bad Credentials". There must then be a different set of permissions between being a contributor to a repo versus using the github-api to query the repo. Correct?

Peabrain
  • 519
  • 2
  • 12
  • Git itself doesn't know a token from Hoboken; this stuff is all up to the add-on software. – torek Oct 26 '21 at 21:16
  • What scopes did you specify when you created the token? – bk2204 Oct 26 '21 at 21:21
  • Just checked off the repo scopes. That's it. "Repo: Full control of private repositories" – Peabrain Oct 26 '21 at 21:34
  • Just to clarify, my profile, the organization (of which there are many), and the repo's are all under a github enterprise account. I do not know if this helps. – Peabrain Oct 26 '21 at 21:37

0 Answers0