2013-03-01 67 views
2

我得到一个名为“tumblrwks”(https://github.com/arkxu/tumblrwks)的库,它使用nodejs连接到tumblr API,我工作,但问题是我想让他们形成一个私人博客,为此我需要OAuth请求。Tumblr API - 如何使用NodeJS获取私人博客的帖子?

如何在Tumblr中获得OAuth(oauth_token & oauth_secret)?

这是我想使用OAuth到COMPLET代码,请帮我

var Tumblr = require('tumblrwks'); 

/* 
    You can get the consumerKey and consumerSecret by registing a tumblr app: http://www.tumblr.com/oauth/apps 
*/ 

var tumblr = new Tumblr(
    { 
    consumerKey: 'YOUR_CONSUMER_KEY', 
    consumerSecret: 'YOUR_CONSUMER_SECRET', 
    accessToken: 'ACCESS_TOKEN', 
    accessSecret: 'ACCESS_SECRET' 
    }, "void2012.tumblr.com" 
    // specify the blog url now or the time you want to use 
); 

tumblr.get('/info', {hostname: 'void2012.tumblr.com'}, function(json){ 
    console.log(json); 
}); 

回答

1

你应该去注册的tumblr的应用程序通过将http://www.tumblr.com/oauth/apps

一旦你完成注册,你会得到你的API密钥。

http://www.tumblr.com/docs/en/api/v2

你需要它来获取您的API密钥,即使你永远不要需要 使用完全签名的OAuth请求

+0

是的,我这样做说明之前,我需要有OAuth请求,以获得在私人博客的帖子 – kach 2013-03-04 08:59:16