Gist / Github API - get private and public Gists

霸气de小男生 提交于 2019-12-23 17:26:03

问题


I am trying to list all gist from a group of users using the github api. This is working really well but I can't seem to get it to return private gists for myself or any others users.

I know that you can set scope in the request but I don't get how I would set this in my JQuery request and what scope should I use to get private gists?

Some of my code is below:

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,

回答1:


You'll need a user to grant access via 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.

http://developer.github.com/v3/oauth/#scopes



来源:https://stackoverflow.com/questions/10219804/gist-github-api-get-private-and-public-gists

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!