使用HelloJS向Tumblr API发出OAuth 1.0a签名请求时遇到问题

使用HelloJS向Tumblr API发出OAuth 1.0a签名请求时遇到问题,api,oauth,tumblr,hello.js,Api,Oauth,Tumblr,Hello.js,我正在尝试与TumblrAPI接口,以获取追随者列表。我对整个OAuth都是全新的,所以我试着在网站上模拟我的演示。不幸的是,他们给出的示例只需要用于标识()的API密钥,而获取追随者需要一个签名的OAuth请求() 我使用的电话是: function getFollowers(blog){ hello('tumblr').api('blog/'+blog+'/followers/').then(function(r){ console.log("r", r); //Bell

我正在尝试与TumblrAPI接口,以获取追随者列表。我对整个OAuth都是全新的,所以我试着在网站上模拟我的演示。不幸的是,他们给出的示例只需要用于标识()的API密钥,而获取追随者需要一个签名的OAuth请求()

我使用的电话是:

function getFollowers(blog){
  hello('tumblr').api('blog/'+blog+'/followers/').then(function(r){
    console.log("r", r);
    //Bellow here not really relevant
    var a = r.data.map(function(item){
      return "<h2>"+item.title+"</h2>"+item.body_abstract;
    });
    document.getElementById('blogs').innerHTML = a.join('');
  });
}
Tumblr的API返回

_hellojs_9kvqxi31({"meta":{"status":401,"msg":"Not Authorized"},"response":[]});

我可以看到登录调用在querystringparameters字段中包含所有OAuth信息,而我尝试创建的一个没有,但是我不确定通过helloJS包含这些信息的正确方式是什么

明白了,函数必须包装在登录方法中。这在另一个示例中显示,但它从api对象调用参数的方式让我感到困惑

function doTheThing(network){
hello( network ).login({force:false}).then( function(r){

  hello('tumblr').api('followers').then(function(r){
    console.log("r", r);

    var a = r.data.map(function(item){
      return "<h2>"+item.title+"</h2>"+item.body_abstract;
    });
    document.getElementById('blogs').innerHTML = a.join('');
  });
  });
  }

//...
tumblr:{
 get: {
   //...
   //This next part needs to be generated dynamically, but you get the idea
    'followers': 'blog/BLOGNAME.tumblr.com/followers',
      }

      callback(p.path);
    }
  },

  post: {
    //...
    'followers': function(p, callback) {
      p.path = 'followers';
      query(p, callback);
    }
  },
函数设置(网络){
你好(网络)。登录({force:false})。然后(函数(r){
hello('tumblr')。api('followers')。然后(函数(r){
控制台日志(“r”,r);
var a=r.data.map(函数(项){
返回“+item.title+”+item.body\u摘要;
});
document.getElementById('blogs').innerHTML=a.join('');
});
});
}
//...
tumblr:{
获取:{
//...
//下一部分需要动态生成,但您可以理解
“followers”:“blog/BLOGNAME.tumblr.com/followers”,
}
回调(p.path);
}
},
职位:{
//...
“followers”:函数(p,回调){
p、 路径='followers';
查询(p,回调);
}
},
function doTheThing(network){
hello( network ).login({force:false}).then( function(r){

  hello('tumblr').api('followers').then(function(r){
    console.log("r", r);

    var a = r.data.map(function(item){
      return "<h2>"+item.title+"</h2>"+item.body_abstract;
    });
    document.getElementById('blogs').innerHTML = a.join('');
  });
  });
  }

//...
tumblr:{
 get: {
   //...
   //This next part needs to be generated dynamically, but you get the idea
    'followers': 'blog/BLOGNAME.tumblr.com/followers',
      }

      callback(p.path);
    }
  },

  post: {
    //...
    'followers': function(p, callback) {
      p.path = 'followers';
      query(p, callback);
    }
  },