node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



Drop in Tumblr API with OAuth for Express.


npm install express-tumblr-oauth

Pass your express app through this module and you'll have Tumblr API capabilities.

// ====== 
// app.js 
// ====== 
var express = require("express")
  , app = express()
  , tumblrAPI = require("express-tumblr-oauth")
var config =
  { oauth:
      { consumer_secret: "YOURSECRETKEY"
      , consumer_key: "YOURCONSUMERKEY"
      , callback: "http://localhost:3000"
tumblrAPI(app, config)


config.oauth.callback should be the base url of your website it will be converted into an appropriate callback url for oauth internally by express-tumblr-oauth


express-tumblr-oauth adds the following routes to your application


$.getJSON("/api/oauth/tumblr/url", function (url) {
  console.log(url) //[oauthtoken] 


express-tumblr-oauth uses this callback internally to finilize the oauth proccess.


works as an authorized proxy to the official tumblr API

$.getJSON("/api/tumblr/dashboard", function (data) {
  console.log(data.meta.status) // 200 

Config options

These are all the options you can pass express-tumblr-oauth and their defaults

var ops = {}
ops.oauth =
  { consumer_key: "key"
  , consumer_secret: "secret"
  , callback: ""
ops.sessionName = "tumblr_oauth"
// used as the variable inside the req.session 
// express object. 
ops.successRedirect =  "/"
// the path to redirect to when oauth is successfully complete 
ops.failureRedirect =  "/"
// the path to redirect to when oauth fails