zan*_*ane 5 octokit.net github-api-v3 github-app
我\xe2\x80\x99创建了一个 GitHub 应用程序并将其安装在我的帐户中,使其可以访问我帐户中的私有存储库。GitHub 应用程序具有元数据的读取权限。\n然后,我生成了一个 JWT 并用它来创建安装访问令牌,按照此处的步骤操作。\n我尝试使用此令牌通过 GitHub 搜索 API 在上述私有存储库中搜索关键字如下:
\nhttps://api.github.com/search/code?q=abc+in:file+repo:username/private-repo\nRun Code Online (Sandbox Code Playgroud)\n但是,这会返回以下响应。
\n{\n "message": "Validation Failed",\n "errors": [\n {\n "message": "The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.",\n "resource": "Search",\n "field": "q",\n "code": "invalid"\n }\n ],\n "documentation_url": "https://docs.github.com/v3/search/"\n}\nRun Code Online (Sandbox Code Playgroud)\n我尝试使用此访问令牌来获取此 GitHub 应用程序安装的存储库,并在响应中成功返回私有存储库。我认为这意味着安装可以访问私有存储库并且令牌按预期工作。\n使用的 API:https://api.github.com/installation/repositories。
那么为什么搜索会失败呢?
\n| 归档时间: |
|
| 查看次数: |
6308 次 |
| 最近记录: |