Access private repos using Github App or OAuth App #36463
-
Hi, I'm a student working to create a CICD pipeline using github app or Oauth App and github repos. I realized that most companies would have their repos private. I looked through the documentation on Github App and OAuth App and I was able to figure out how to get a list of public repos but I'm unable to retrieve the private repos. I'm using Javascript to get the list of repos. Below is my code, I tried the const octokit = new Octokit({
auth: token
});
try {
const response = await octokit.request('Get /user/repos?type=private', {});
return response.data;
} catch(e) {
console.log(e.message);
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
After some digging and testing, I was able to figure out the problem. In order to view and access private repos, the Github App needs to be installed on the user's account. I was able to install my Github App on the account and from there I was able to access the private repos. |
Beta Was this translation helpful? Give feedback.
-
Hey there @melchanti and thank you for asking a good question! I'm glad you found our community 🙂 |
Beta Was this translation helpful? Give feedback.
-
The access token generated by a GitHub app will not work with the |
Beta Was this translation helpful? Give feedback.
After some digging and testing, I was able to figure out the problem. In order to view and access private repos, the Github App needs to be installed on the user's account. I was able to install my Github App on the account and from there I was able to access the private repos.