我正在尝试使用 github api 列出一组用户的所有要点。这工作得很好,但我似乎无法让它为我自己或任何其他用户返回私有(private)要点。
我知道您可以在请求中设置范围,但我不知道如何在 JQuery 请求中设置它以及我应该使用什么范围来获取私有(private)要点?
我的一些代码如下:
var the_url = 'https://api.github.com/users/'+ encodeURIComponent(user) +'/gists';
$.oauth ({
consumerKey: 'xxxxxxxxxxxxxxxxx',
consumerSecret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
type: "GET",
url: the_url,
data: {},
dataType: 'json',
async: false,
最佳答案
您需要用户通过 oAuth 授予访问权限。
You can read public gists and create them for anonymous users without a token; however, to read or write gists on a user’s behalf the gists oAuth scope is required.
关于jquery - Gist/Github API - 获取私有(private)和公共(public) Gist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10219804/