curl -d “json_data={
owner: ‘xiazemin’,
repo: ‘MyBlogComment’,
oauth: {
client_id: ‘981ba8c916c262631ea0’,
client_secret: ‘a52260ef92de69011ccd1cf355b973ef11d6da0e’,
}” https://github.com/xiazemin/MyBlogComment/issues/33
直接curl 授权成功
curl -u xiazemin:xxxxxxxxxxx https://api.github.com/repos/xiazemin/MyBlogComment/issues/33/comments
curl -H “Authorization: token xxxxxxxxxxx” https://api.github.com/repos/xiazemin/MyBlogComment/issues/33/comments
自己请求不成功
//url="https://github.com/login/oauth/access_token?client_id=981ba8c916c262631ea0&client_secret=a52260ef92de69011ccd1cf355b973ef11d6da0e&callback=parseQueryString&code="+code;
// var script = document.createElement('script');
// script.setAttribute('src', url);
// // 把script标签加入head,此时调用开始
// document.getElementsByTagName('head')[0].appendChild(script);
// $.ajax({ // type: "POST", // url: url, // dataType: 'json', // async: false, // xhrFields:{ // withCredentials:false // }, // beforeSend: function(request) { // // request.setRequestHeader("Content-Type", "application/json"); // request.setRequestHeader("Accept","application/json"); // }, // crossDomain:true, // success: function(json) { // console.log(json);//console.log(query);//åconsole.log(json); // alert(json); // }, // error: function(e) { // console.log(e); // alert(e); // } // }); // $.ajax({
// type: "GET",
// url: "https://github.com/login/oauth/access_token?client_id=981ba8c916c262631ea0&client_secret=a52260ef92de69011ccd1cf355b973ef11d6da0e&code="+code,
// success: function(json) {
// console.log(json);
// document.getElementById("token").innerHTML="token:"+json.access_token;
// alert(json.access_token);
// }
// });
// code=”4a76c07d47d5da05e035”;
// url=”https://gh-oauth.imsun.net?client_id=981ba8c916c262631ea0&client_secret=a52260ef92de69011ccd1cf355b973ef11d6da0e&code=”+”4a76c07d47d5da05e035”;
// jsonData=’{“client_id”:”981ba8c916c262631ea0”,”client_secret”:”a52260ef92de69011ccd1cf355b973ef11d6da0e”,”code”:”‘+code+’”}’;
// $.ajax({
// type: “POST”,
// url: “https://gh-oauth.imsun.net”,
// contentType: “application/json; charset=utf-8”,
// data:jsonData,
// dataType: “json”,
// success: function (message) {
// console.log(message);
// alert(message);
// },
// error: function (message) {
// console.log(message);
// alert(message);
// }
// });
//alert(window.location.search);
</script>