【发布时间】:2020-09-26 02:38:33
【问题描述】:
在具有 repo 和 user 授权范围的 GitHub API v3 中,我可以使用 GET /user/orgs(https://developer.github.com/v3/orgs/#list-organizations-for-the-authenticated-user,使用 Octokit REST JS,octokit.orgs.listForAuthenticatedUser() ) 并为每个组织获取我可以访问的存储库,GET /orgs/:org/repos(https://developer.github.com/v3/repos/#list-organization-repositories,使用 Octokit,octokit.repos.listForOrg({ org: orgs.data[i].login }))。
但是,使用相同的身份验证范围(用户和存储库),运行此 Graphql 查询
query getOrgsRepos {
viewer {
organizations(first: 10) {
nodes {
repositories(first: 10) {
nodes {
name
}
}
}
}
}
}
返回
{
"data": {
"viewer": {
"organizations": {
"nodes": []
}
}
}
}
Graphql Explorer 结果 (https://developer.github.com/v4/explorer/),但在我的 JS authed(user 和 repo 范围)应用程序上运行返回相同的空结果
如何在 API v4 中实现相同的行为,无需授予更多权限?
【问题讨论】:
标签: github graphql github-api octokit-js