2013-03-01 66 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