express-tumblr-oauth
"Drop in Tumblr API with OAuth for Express"
Last updated 6 years ago by talon .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install express-tumblr-oauth 
SYNC missed versions from official npm registry.

express-tumblr-oauth

Drop in Tumblr API with OAuth for Express.

How

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)

app.listen(3000)

NOTE:

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

Interface

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

/api/oauth/tumblr/url

$.getJSON("/api/oauth/tumblr/url", function (url) {
  console.log(url) // http://www.tumblr.com/authorize?oauth_token=[oauthtoken]
})

/api/oauth/tumblr/callback

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

/api/tumblr/*

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 = {}

// REQUIRED
ops.oauth =
  { consumer_key: "key"
  , consumer_secret: "secret"
  , callback: "mywebsite.com"
  }

//OPTIONAL

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


Current Tags

  • 0.0.7                                ...           latest (6 years ago)

7 Versions

  • 0.0.7                                ...           6 years ago
  • 0.0.6                                ...           6 years ago
  • 0.0.5                                ...           6 years ago
  • 0.0.4                                ...           6 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 2
Last Day 2
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |