Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
753 views
in Technique[技术] by (71.8m points)

authentication - GitHub API: using 'repo' scope, but still can't see private repos

Per the GitHub API docs, I am requesting the repo scope which gives access to private repositories.

The user is presented with the following dialog, which also mentions private repos. They accept the application.

enter image description here

Despite this, when using the oauth access token obtained when asking for 'repo' access, I can only see public repos when I GET https://api.github.com/users/someusername/repos. No private repos are shown.

The user account is my own, and I have not revoked access.

How can I see private repos using the GitHub API V3?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From testing:

  • GETing /users/someusername/repos doesn't show private repos (even if it's the user whose oauth access token you're using).

  • GETing /user/repos show private repos.

This isn't documented in the GitHub API docs at present, I just found out via testing.

Thanks to @ivanzuzak for suggesting to look at the endpoint.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...